You probably just want to limit concurrency of compute-heavy stuff, so set OMP_NUM_THREADS=1 and num_workers=1 . But thread switching in general is fast, you won’t get much benefit from getting rid of threads that sit idle most of the time. You can see what all the threads are doing “sudo gdb -p  … thread apply all bt”