GIL and uniprocessor machines

Martin v. Löwis martin at v.loewis.de
Tue Jun 3 14:40:53 EDT 2003


aahz at pythoncraft.com (Aahz) writes:

> >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.

More generally, in a single processor machine, the system may be able
to switch threads at a time it considers appropriate. With the GIL,
the system's choice of alternative new threads is reduced to
non-Python threads, unless the active Python thread has released the
GIL.

Regards,
Martin




More information about the Python-list mailing list