[Python-ideas] Remove GIL with CAS instructions?

Steven D'Aprano steve at pearwood.info
Wed Oct 21 13:05:34 CEST 2009

On Wed, 21 Oct 2009 03:09:01 pm Adam Olsen wrote:
> On Tue, Oct 20, 2009 at 18:22, Sturla Molden <sturla at molden.no> wrote:
> > Adam Olsen skrev:
> >> This'd show you the minimum amount of overhead, but only for a
> >> trivial case: single threaded.
> >
> > As far as I know, the single-threaded case is the reason for
> > keeping the GIL.
> No, single-threaded is the reason for keeping the GIL *as an option*.
> The complete lack of any other viable option (in CPython) is the
> reason it's the only option.

I'm not entirely sure what you're trying to say there, but I'd like link 
to what Guido said over two years ago:


... I'd welcome a set of patches into Py3k only if the performance for a 
single-threaded program (and for a multi-threaded but I/O-bound 
program) does not decrease.
I would also be happy if someone volunteered to maintain a GIL-free fork 
of Python...
However, I want to warn that there are many downsides to removing the 
GIL. ...
I want to point out one more time that the language doesn't require the 
GIL -- it's only the CPython virtual machine that has historically been 
unable to shed it.
[end quote]

Steven D'Aprano

More information about the Python-ideas mailing list