[Python-ideas] Ideas towards GIL removal
Jan Kanis
jan.kanis at phil.uu.nl
Fri Apr 13 18:51:18 CEST 2007
On Fri, 13 Apr 2007 08:51:11 +0200, Talin <talin at acm.org> wrote:
> Now, all that being said, even if such a GC library were to exist, that
> is a long way from removal of the GIL, although it is a necessary step.
> For example, take the case of a dictionary in which more than one thread
> is inserting values. Clearly, that will require a lock or some other
> mechanism to prevent corruption of the hash table as it is updated. I
> think we want to avoid the Java situation where every object has its own
> lock. Instead, we'd have to require the user to provide a lock around
> that insertion operation. But what about dictionaries that the user
> isn't aware of, such as class methods and module contents? In a world
> without a GIL, what kind of steps need to be taken to insure that shared
> data structures can be updated without creating chaos?
In the case of hashtables, a nonblocking variant could perhaps be an
option. There was a nice article on reddit some time ago:
http://blogs.azulsystems.com/cliff/2007/03/a_nonblocking_h.html , the guy
claims that it's competitive in speed to non-lock protected (so thread
unsafe) implementations. Nonblocking algorithms don't exist for all data
structures, but perhaps they exist for most ones that are used in the
python interpreter?
- Jan
More information about the Python-ideas
mailing list