[docs] [issue27422] Deadlock when mixing threading and multiprocessing

Davin Potts report at bugs.python.org
Mon Jul 4 15:29:36 EDT 2016

Davin Potts added the comment:

@r.david.murray:  Oh man, I was not going to go as far as advocate dropping the GIL.  :)

At least not in situations like this where the exploitable parallelism is meant to be at the Python level and not inside the Fortran code (or that was my understanding of the setup).  Martin had already mentioned the motivation to fork to avoid side effects possibly arising somewhere in that code.

In practice, after dropping the GIL the threads will likely use multiple of the cores -- though that's up to the OS kernel scheduler, that's what I've observed happening after temporarily dropping the GIL on both Windows and Linux systems.  

As to the benefit of CPU affinity, it depends -- it depends upon what my code was and what the OS and other system processes were busily doing at the time my code ran -- but I've never seen it hurt performance (even if the help was diminishingly small at times).  For certain situations, it has been worth doing.

Correction:  I have seen cpu affinity hurt performance when I make a bone-headed mistake and constrain too many things onto too few cores.  But that's a PEBCAK root cause.


Python tracker <report at bugs.python.org>

More information about the docs mailing list