GIL and uniprocessor machines

Aahz aahz at pythoncraft.com
Tue Jun 3 15:38:58 CEST 2003


In article <20d6d41f.0306030415.18f4c093 at posting.google.com>,
Joe Cheng <code at joecheng.com> wrote:
>
>I was wondering about the effect of the global interpreter lock on
>single-processor machines.  Clearly on a multi-processor machine, not
>being able to have each processor crunching bytecode instructions is a
>(potential) bottleneck.  But a (non-hyperthreading) single-processor
>machine can only deal with one thread at a time anyway, right?  So the
>GIL should actually not be a restriction at all in that case?

You're half-right.  However, even on a single-CPU machine, handling
multiple I/O requests concurrently does give a speed boost, which is why
Python has a mechanism for releasing the GIL in C extensions -- and all
the reentrant-capable I/O calls in the standard library release the GIL.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra




More information about the Python-list mailing list