threads and sleep?

Grant Edwards grante at visi.com
Tue Jul 5 18:07:27 CEST 2005


On 2005-07-05, Grant Edwards <grante at visi.com> wrote:

>> Don't think you can do that with Python... The Python runtime
>> interpreter itself is running on a single processor.
>
> I don't see how that can be.  Under Linux at least, the Python
> threading module uses "real" OS threads, so there are multiple
> instances of the interpreter, right?  Generally all but one of
> them will be blocked on the GIL, but there are still multiple
> interpreter threads (which can be on multiple different CPUs).
>
> Or is the Python interpreter actually doing the context
> switches itself?

Upon further thought, that just can't be the case.  There has
to be multiple instances of the intepreter because the
interpreter can make C system calls that block (thus blocking
that instance of the interpreter). Other Python threads within
the program continue to run, so there must be multiple Python
intepreters.

-- 
Grant Edwards                   grante             Yow!  I'm wearing PAMPERS!!
                                  at               
                               visi.com            



More information about the Python-list mailing list