Threading in Python

David Bolen db3l at fitlinxx.com
Fri Jul 27 02:40:04 EDT 2001


"Andy" <andy at mindgate.net> writes:

> One thing Java has which Python lacks is transparent
> support for multi-cpu threading.  Python has threads,
> but I believe it is internally implemented and has
> been shown not to take advantage of an SMP machine.

Python threads are native OS threads (which I don't think is what you
mean by internally implemented).

However, you are correct that given the global interpreter lock (only
one thread can be executing actual Python bytecodes at any given
time), it's not very amenable to SMP systems.  That is, unless the
multi-processing you want to do is off in an extension module that
releases the lock before doing it's work.

I have a feeling that changing the GIL would be a very large
undertaking.  In some ways less arguable than stuff like the recent
division changes, since if done right it needn't break any existing
interfaces, but it would surely be a much higher risk set of changes.
Not that it's a bad idea, mind you - just a hard one.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list