Threading in python

Carl J. Van Arsdall cvanarsdall at
Wed Dec 14 00:40:41 CET 2005

Hi everyone, I'm trying to use the threading module with python 2.2 and 
I have some questions regarding python's threading.

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?

2.  I've read that python threads don't like to allow other threads to 
run except in certain situations, these would be situations where there 
is sleep or I/O happening, is this true?  If so, what are the cases in 
which a python thread would not give up the processor?

3.  Is there a way to which thread is running? I mean something a bit 
more robust than a print statement inside the thread, I want to be able 
to see when a context switch occurs, is this possible?  The reason for 
this is I will have threads deadlocked waiting for I/O and I am 
interested to see how often context switching occurs.

Thanks in advance,



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

More information about the Python-list mailing list