Tim Peters tim_one at
Fri Jun 4 07:15:11 CEST 1999

[Arne Mueller]
> Hi All, I'm using the threading module in python 1.5.2b2. I'm
> wondering wheather the different threads are all executed in
> parallel on a multiprocessor machine.

[Jeremy Hylton]
> The short answer is no.  The Python interpreter has a lock that
> prevents allows only a single thread to execute at a time.

[Hrvoje Niksic]
> Eek.  That's depressing.  Isn't supporting threads and not allowing
> simultaneous execution a bit weird?

The serialization only applies to those threads trying to interpret Python
bytecodes at a given time; they have to take turns then, but can run off in
parallel while doing anything else (typically doing I/O, or off in an
extension module with its own ideas about threads).

There are a mass of hairy tradeoffs, and for Python 1.4 there exists a large
set of "free threading" patches (by Greg Stein) that removed the global
lock.  Some good news, some bad news, but old news all the same <wink>.

Oh ya -- in answer to your question, yes!  It is a bit weird.

what-does-that-make-us?-ly y'rs  - tim

More information about the Python-list mailing list