python threads and the linuxthread pthread library

Tim Peters tim.one at comcast.net
Wed Jul 3 00:40:08 EDT 2002


[holger krekel]
> I have been told (at EuroPython and anywhere else) that removing the GIL
> is just too hard.

Greg Stein did it once, long ago.  Search for "free threading" in old
archives, perhaps particularly in the defunct Thread-SIG.  A single-threaded
Python program ran about 2x slower as a result; the need for mutual
exclusion doesn't go away, and in effect one honking giant hammer of a lock
(the GIL) got replaced with many teensy short-lived locks.  That's got
substantial overhead of its own, although I'm sure it could have been
significantly reduced if anyone had mountains of time to throw at it.

Removing the GIL would be substantially harder today.  There are both gross
and exceedingly subtle reliances on that the GIL is held, all over Python's
C code, and the extent of that reliance has only grown since Greg did his
experiment.

multiple-processes-remain-your-best-friends-ly y'rs  - tim






More information about the Python-list mailing list