Status of Python threading support (GIL removal)?

OdarR Olivier.Darge at
Fri Jun 19 20:08:31 CEST 2009

On 19 juin, 19:13, s... at wrote:
>     Olivier> what do you mean ?
>     Olivier> Cpython can't benefit from multi-core without multiple
>     Olivier> processes.
> It can, precisely as Martin indicated.  Only one thread at a time can hold
> the GIL.  That doesn't mean that multiple threads can't execute.  Suppose

I don't say multiple threads can't execute....(?).
I say that with the Python library, I don't see (yet) benefit with
multiple threads *on* multiple CPU/core.

Ever seen this recent video/presentation ? :

> you have two threads, one of which winds up executing some bit of C code
> which doesn't mess with the Python run-time at all (say, a matrix multiply).

I don't know how to do that with common Python operations...
Only one thread will be really running at a time in memory (meanwhile
other thread are waiting).
Are you refering to a specialized code ?

> Before launching into the matrix multiply, the extension module releases the
> GIL then performs the multiply.  With the GIL released another thread can
> acquire it.  Once the multiply finishes the first thread needs to reacquire
> the GIL before executing any calls into the Python runtime or returning.

I don't see such improvement in the Python library, or maybe you can
indicate us some meaningfull example...?

I currently only use CPython, with PIL, Reportlab...etc.
I don't see improvement on a Core2duo CPU and Python. How to proceed
(following what you wrote) ?

A contrario, I saw *real* improvement on parallel computing with the
Py 2.6 multiprocessing module.


More information about the Python-list mailing list