Status of Python threading support (GIL removal)?

Stefan Behnel stefan_ml at
Sun Jun 21 13:20:11 CEST 2009

Jure Erznožnik wrote:
> On Jun 20, 1:36 am, a... at (Aahz) wrote:
>> You should put up or shut up -- I've certainly seen multi-core speedup
>> with threaded software, so show us your benchmarks!
>> --
> Sorry, no intent to offend anyone here. Flame wars are not my thing.
> I have shown my benchmarks. See first post and click on the link.
> That's the reason I started this discussion.
> All I'm saying is that you can get threading benefit, but only if the
> threading in question is implemented in C plugin.
> I have yet to see pure Python code which does take advantage of
> multiple cores. From what I read about GIL, this is simply impossible
> by design.

Well, CPython is written in C. So running Python code in CPython will
necessarily run C code (whatever "plugin" means in your post above). If
that C code frees the GIL or not depends on the parts of CPython or
external packages that you use. And there are many parts that free the GIL
and will thus benefit (sometimes heavily) from threading and
multiple-cores, and there are also many parts that do not free the GIL and
will therefore not (or likely not) benefit from multiple-cores.

Claiming that "pure Python code does not free the GIL" in the context of
CPython when you define "pure Python code" as code that does not depend on
C code is plain flawed.


More information about the Python-list mailing list