Python threads: backed by OS threads?
David Arnold
arnold at dstc.monash.edu.au
Thu May 11 06:30:55 EDT 2000
-->"Courageous" == Courageous <jkraska1 at san.rr.com> writes:
Courageous> I just read that. It suggests that the threads may be
Courageous> mutually locking eachother out some of the time, but it
Courageous> does not say that they will not see a performance gain
Courageous> once you discount the contention issues.
whenever the threads are within the python interpreter itself, the are
mutually exclusive.
calls out to C extensions tend to release the interpreter lock, unless
the operation is purely computational and short-lived. so all I/O,
time.sleep(), etc release the lock.
the end result is that an I/O bound process will see substantial
improvements by threading. CPU-bound processes will not, regardless
of multi-processor machines.
there is ongoing work to support so-called "free-threading" of the
interpreter, usually discussed within the Thread-SIG. patches were
available for 1.4, and the underpinnings of the interpreter have been
gradually gaining support for it. the rough plan is to have it
available as a compile-time option in the not-too-distant future.
d
More information about the Python-list
mailing list