[Python-Dev] Threading in the Standard Library Tour Part II
Stephen J. Turnbull
stephen at xemacs.org
Mon Aug 16 05:38:30 CEST 2004
>>>>> "Raymond" == Raymond Hettinger <python at rcn.com> writes:
Raymond> Threading is a technique for decoupling tasks which are
Raymond> not sequentially dependent and creating the illusion of
Raymond> concurrency.
All simultaneity is an illusion, but the concurrency of Python threads
is not. <wink>
Raymond> Also, multiple processors cannot boost performance
Raymond> because Python's Global Interpreter Lock (GIL) precludes
Raymond> more than one thread from running in the interpreter at
Raymond> the same time (this was done to simplify re-entrancy
Raymond> issues).
This confused me because "running" is ambiguous. How about something
like:
The Python interpreter itself is not fully reentrant, so threading
is accomplished by interleaving the execution of Python code from
different threads. Thus, use of multiple processors cannot boost
performance of threaded Python code, because a single instance of
the interpreter can only execute code on one processor at a time.
(Season to taste, fix technical inaccuracies.) I see no reason to
mention the GIL, an implementation detail, at all.
--
Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
More information about the Python-Dev
mailing list