Global Locking

Aahz aahz at pythoncraft.com
Mon Aug 5 20:22:48 EDT 2002


In article <mailman.1028569089.9483.python-list at python.org>,
Daniel Parks  <Dan.Parks at CAMotion.com> wrote:
>
>I know that python has made the design decision to use a Global lock
>to control threading (GIL).  However, I am developing a system in
>which throughput is much less important than switching speed among
>threads.  Has anyone thought of modifying python to this extent?  I
>understand why the design decision for one big lock was made, however,
>for my specific needs it simply is not the right decision.  Therefore,
>I am thinking about altering python to have a series of finer grained
>locks. Has anyone already done this?  Has anyone ever tried to do
>this?  

To partially summarize what Tim pointed you at, the problem is that
there are a lot of structures in Python that simply assume that they
hold the GIL when they get operated on.  This reliance on the GIL has
increased over the years (not decreased) as it has become more evident
that computational threading isn't a large part of Python's usage base.
Anyone who really cares about computational threading should write a C
extension for the grunt work.  One of these days^H^H^H^Hyears, I'll
finish my BCD module to demonstrate how to do this.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/



More information about the Python-list mailing list