threading and multicores, pros and cons

Paul Rubin http
Thu Feb 15 00:20:31 EST 2007


Maric Michaud <maric at aristote.info> writes:
> > "Some time back, a group did remove the GIL from the python core, and
> > implemented locks on the core code to make it threadsafe. Well, the
> > problem was that while it worked, the necessary locks it made single
> > threaded code take significantly longer to execute."
> 
> Very interesting point, this is exactly the sort of thing I'm
> looking for. Any valuable link on this ?

I think it was a long time ago, Python 1.5.2 or something.  However it
really wasn't that useful, since as Garrick said, it slowed Python
down.  The reason was CPython's structures weren't designed for thread
safety so it needed a huge amount of locking/releasing.  For example,
adjusting any reference count required setting and releasing a lock,
and CPython does this all the time.  Getting rid of the GIL in a
serious way requires radically changing the interpreter, not just
sticking some locks here and there.



More information about the Python-list mailing list