Re: Short sleep precision

From: Andrew Morton
Date: Sun Mar 20 2005 - 08:06:02 EST


Jan Engelhardt <jengelh@xxxxxxxxxxxxxxx> wrote:
>
> I have found that FreeBSD has a very good precision of small sleeps --

Linux nanosleep() used to have a busywait loop for sleeps less than two
milliseconds. 2.4.x still does.

We thought it was stupid and took it out.

> what's holding Linux back from doing the same? Using the code snippet below,
> FBSD yields between 2 and 80 us on the average while Linux is at
> "constantly" ~100 (with HZ=1000) and ~1000 (HZ=100).
>

You can spin on the gettimeofday() result in userspace.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/