Threading unfairness

Peter Hansen peter at engcorp.com
Tue May 21 00:26:55 EDT 2002


Jochen Küpper wrote:
> 
> On Sun, 19 May 2002 08:50:41 -0400 Peter Hansen wrote:
> 
> Peter> We had been unthinkingly using time.sleep(0.01) for a while,
> Peter> just kind of blindly using it as a free "yield timeslice".
> 
> Python uses 'select' for the sleep implementation (besides special
> cases like Max, Windozer, ...).
> 
> On Linux the resolution of select is depending on the HZ kernel config
> variable.  On x86 it is (standard-wise) 100 (Hz), giving you 10 ms.

So does that mean that while time.sleep(0.01) really sleeps for 10 ms, 
time.sleep(0.001) translates to a "yield", or does it round up to
the next tick?  (Or if you'd rather teach me how to fish, where's
a good place (please don't say "the source" ;-) to find this out myself?

> You might want to look at something like userspace-RTAI or KURT if you
> do soft-realtime on Linux.

It's working fine without that step so far, but thanks for the tip.

-Peter



More information about the Python-list mailing list