Threading unfairness

Jochen Küpper jochen at jochen-kuepper.de
Sun May 19 23:57:55 EDT 2002


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".
                    ^^^^^^^

Yep.  And then no documentation... :)

Peter> (I'll offer here to listen intently to anyone willing to share 
Peter> his or her knowledge of implementation details (under Linux) relating 
Peter> to what sleep() does with that delay... what _is_ the resolution?)

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.
On Linux/AXP it is 1024, IIRC.  Some people set it to higher values,
although that has other implications, too.

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

Greetings,
Jochen
-- 
Einigkeit und Recht und Freiheit                http://www.Jochen-Kuepper.de
    Liberté, Égalité, Fraternité                GnuPG key: 44BCCD8E
        Sex, drugs and rock-n-roll



More information about the Python-list mailing list