python threads on multi-CPU machines

Aahz aahz at pythoncraft.com
Mon Aug 18 04:31:03 EDT 2003


In article <vQn*aWb0p at news.chiark.greenend.org.uk>,
Thomas Womack  <twomack at chiark.greenend.org.uk> wrote:
>
>If I have a dual-processor hyperthreaded machine (so with four CPU
>contexts), will a python program distribute threads over all four
>logical processors?

Maybe.  Python has a Global Interpreter Lock (GIL), so only one thread
can run Python code at any time.  However, C extensions can release the
GIL, and almost all I/O code in Python does that, so I/O-heavy programs
will make good use of the SMP.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

This is Python.  We don't care much about theory, except where it intersects 
with useful practice.  --Aahz




More information about the Python-list mailing list