Global Locking

Daniel Parks Dan.Parks at CAMotion.com
Mon Aug 5 20:41:37 CEST 2002


On Mon, 2002-08-05 at 21:15, Tim Peters wrote:
> [Daniel Parks]
> > ...
> > Therefore, I am thinking about altering python to have a series of finer
> > grained locks. Has anyone already done this?
> 
> About 6-7 years ago Greg Stein did it for Python 1.4.  Do a Google search on
> 
>     free threading python
> 
> Note that current CVS Python implements the GIL via POSIX semaphores (when
> available) rather than with pthread condvars.  That may (or may not) work
> better for you.

CVS Python's implementation does work better than previous versions of
python according to my tests.  Furthermore, I have added a sched_yield()
(I doubt that's portable....but I don't care) in the interpreter code
every time it gives up the GIL.  These make the performance of python
more in line with what I want, but I'm not sure if it is *ENOUGH*.  I
just got a look at Greg's code....it does seem to be a good amount of
code, so it's definitely not going to be trivial ( I didn't really think
it would be)  On his web site he mentions adding it to Python 1.6. 
Considering where python is at right now....I take that to be the end of
the line for him.  Oh well.....I'm going to take a deeper dive into it
now....see what he did exactly.

Dan






More information about the Python-list mailing list