Hrvoje Niksic hniksic at
Fri Jun 4 05:57:38 EDT 1999

"Andrew M. Kuchling" <akuchlin at> writes:

> Hrvoje Niksic writes:
> >Jeremy Hylton <jeremy at> writes:
> >> The short answer is no.  The Python interpreter has a lock that
> >> prevents allows only a single thread to execute at a time.
> >
> >Eek.  That's depressing.  Isn't supporting threads and not allowing
> >simultaneous execution a bit weird?
> I don't think so, because the common case is probably not the one
> where lots of work is being done in Python code.

Well, I do think so.  The "common case" may be that lot of work is not 
done in Python code, but maybe such common cases emerge from lousy
execution to begin with.

Dividing threaded programs to IO-heavy and computation-heavy misses
the point because many realistic cases have some of both -- for
instance, an internet server under heavy load.  Python's
characteristics make it quite suitable for such a purpose, and having
threads lock each other off is a _definite_ minus on a multi-CPU

Maybe it would be possible to make the actual interpreter thread-safe,
and only lock when an extension of unknown thread-safety is called.

More information about the Python-list mailing list