[Python-ideas] Remove GIL with CAS instructions?

Nick Coghlan ncoghlan at gmail.com
Wed Oct 21 14:31:12 CEST 2009


Sturla Molden wrote:
> Benjamin Peterson skrev:
>> I eagerly await your patch!   
> I'd gladly contribute to the effort, but I did not say it is an easy
> task :-)
> 
> I just wanted to bring this up:
> 
> - The GIL has consequences on multicore CPUs that are overlooked: thread
> switches are usually missed at check intervals.

In the rare case where none of those threads are releasing the GIL for
any other reason, time.sleep(0.001) works wonders. Yeah, it's a wart,
but not a particularly difficult one to deal with.

That tangent aside, the major problem with removing the GIL has never
been the concept of doing so, but the practicality of implementing it in
a cross-platform way that doesn't hurt single threaded performance.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list