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

"Martin v. Löwis" martin at v.loewis.de
Sun May 16 23:38:35 CEST 2010


Bill Janssen wrote:
> Nick Coghlan <ncoghlan at gmail.com> wrote:
> 
>> Bill Janssen wrote:
>>> As far as I'm concerned, just tying all of
>>> the program's threads to a single core would be fine, though I imagine
>>> others would differ.
>> Which can be done through the OS tools for setting an application's CPU
>> affinity.
> 
> Yes, as I say, if the initialization of the threading module called
> those tools appropriately and automatically, I'd be happy.  Well, less
> unhappy :-).
> 
> I have to admit, I don't know how to do this on OS X.  What's the
> tool and the process, if we're not getting too far afield?

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).

IIUC, an affinity preference does not survive exec(2), so you can't
write a tool that binds all threads of its child processes to a single
core (such a tool is available on many unices, though).

Regards,
Martin


More information about the Python-Dev mailing list