[Python-Dev] Fixing the GIL (with a BFS scheduler)

Bill Janssen janssen at parc.com
Mon May 17 00:13:44 CEST 2010


Martin v. Löwis <martin at v.loewis.de> wrote:

> OSX doesn't really support thread affinity. The affinity API that they
> have is described on
> 
> http://developer.apple.com/mac/library/releasenotes/Performance/RN-AffinityAPI/index.html
> 
> You can't bind a thread to specific core with it, though, but you can
> requests that multiple threads all run on the same core (leaving the
> choice "which core" to the system).

I believe that would be sufficient to fix the problem with Python,
though I wonder about the effect on JCC-generated modules like pylucene,
where the threads are really Java threads as well as Python threads.

So the patch to the threading code would presumably, for those OSs where
the capability exists, try to put all created threads in the same
affinity set.  Presumably there would also be a way to clear that
binding, for folks who know what they're doing.

Bill


More information about the Python-Dev mailing list