Threading in python

Carl J. Van Arsdall cvanarsdall at mvista.com
Wed Dec 14 12:33:15 EST 2005


> These answers assume you're using CPython; Jython and IronPython have
> different answers.
>
>   
This confuses me.  What is CPython versus Jython and IronPython?  I'm 
using compiled source from python.org, would this be CPython?


>> 1.  Who schedules which threads run and when?  Is this something left up 
>> to the operating system or does python provide a mechanism for this?
>>     
>
> Strictly OS -- Python provides no control.
>   

I did some research yesterday, and I'd like some clarification.  So the 
OS handles which thread runs and when, however if one of the python 
processes currently holds the global interpreter lock, when the OS 
switches to a python thread that does not have this lock, this thread 
will do nothing.   Does this sound right?  Ultimately python does 
control what thread runs by controlling the global interpreter lock 
although its the underlying OS that handles all the context switching etc.

Because of this global interpreter lock does this mean its impossible to 
get speed up with threading on multiple processor systems?  I would 
think so because only one python thread can execute at any one time.  Is 
there a way to get around this?  This isn't something I need to do, I'm 
just curious at this point.



-c


-- 

Carl J. Van Arsdall
cvanarsdall at mvista.com
Build and Release
MontaVista Software




More information about the Python-list mailing list