Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Bad sleep time resolution of nanosleep(2)



rhialto%falu.nl@localhost (Rhialto) writes:

>For the standard HZ=3D100, one would expect the worst resolution to be
>1000/100 =3D 10 ms.

The resolution is 10ms, but since it waits for at least 10ms this can only
happen when the current tick interval is expiring in the same moment.

A loop waiting for the 'next tick' will always wait for (almost) two ticks
because the first interval has already started when you wake up from the
previous loop.


-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index