[Python-ideas] Optimistic Concurrency

Leonardo Santagada santagada at gmail.com
Mon Oct 20 05:16:48 CEST 2008

On Oct 20, 2008, at 12:05 AM, skip at pobox.com wrote:

> Clearly the GIL is too coarse a level of locking because it  
> eliminates all
> possible parallelism.  Is it possible that some finer grained  
> locking (but
> still coarser than complete free threading) can give you back some  
> of the
> possible parallelism?  Maybe reqire all mutable types to support a  
> GIL of
> their own?

This is the idea that they are planing to do in PyPy.

Another idea that maybe have a chance of working is implementing  
Software Transactional Memory on the interpreter level and use it to  
implement threading... and maybe have an application (that is, able to  
be used inside a python program) level STM to make programs more  
easily parallel (so no need to use locking, semaphores and monitors).

I think that trying to do all that in CPython is nearly impossible, as  
removing refcount, move to finer grained locking and testing all in  
the current CPython would be a lot of work to do and take a lot of  
time, to then having to resync with the modifications that are bound  
to happen during that time in CPython. Also keeping compatibility with  
the CPython external API would be very hard (but doable, there is even  
some people trying to do it for running numpy on ironpython).

Just my 0,02 cents
Leonardo Santagada
santagada at gmail.com

More information about the Python-ideas mailing list