Status of Python threading support (GIL removal)?

Tyler Laing trinioler at
Fri Jun 19 09:47:38 EDT 2009

This is a very long-running issue, that has been discussed many times. Here
are the two sides to keeping the gil or removing it:

Remove the GIL:

   - True multi-threaded programming
   - Scalable performance across a multi-core machine
   - Unfortunately, this causes a slow-down in single core/thread
   - Most of the slow down comes from Python's Reference counting, as every
   function is supposed to increase and decrease the references... which leads
   to a lot of synchronization and checking of locks.
   - It makes the core interpreter much more complex

Keeping the GIL:

   - Processes should be used instead of threads. Look at Erlang, THE model
   of concurrency. It uses a process model for concurrency and message passing,
   rather than threads. This means you avoid deadlocks, livelocks, race
   conditions(not entirely, but they are reduced)
   - C extensions can still gain really impressive multi-threaded
   performance. My C extension, a wrapper around ffmpeg, releases the GIL for
   90% or so of its processing time, so all other threads are still extremely
   - It allows python to stay simple, understandable, and offer good
   performance, if you know how to use it properly.

Basically the two sides are that you it ends up slowing things down, it
makes the interpreter more complex vs you should use processes instead, and
be smart about how you use the GIL.

On Fri, Jun 19, 2009 at 2:52 AM, Jure Erznožnik <jure.erznoznik at>wrote:

> See here for introduction:
> Digging through my problem, I discovered Python isn't exactly thread
> safe and to solve the issue, there's this Global Interpreter Lock
> (GIL) in place.
> Effectively, this causes the interpreter to utilize one core when
> threading is not used and .95 of a core when threading is utilized.
> Is there any work in progess on core Python modules that will
> permanently resolve this issue?
> Is there any other way to work around the issue aside from forking new
> processes or using something else?
> --

Visit my blog at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list