[lkml]   [2002]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: nanosleep
Followup to:  <>
By author: "mark manning" <>
In newsgroup:
> thanx - how much of a difference should i expect - i know the
> syscall is asking for at least the required ammount but that the
> task switcher might not give me control back for a while after the
> requested delay but i was expecting to be a little closer to what i
> had asked for - this isnt critical of corse but i would like to know
> what to expect.

Read the man page:

The current implementation of nanosleep is based on the
normal kernel timer mechanism, which has a resolution of
1/HZ s (i.e, 10 ms on Linux/i386 and 1 ms on Linux/Alpha).
Therefore, nanosleep pauses always for at least the speci­
fied time, however it can take up to 10 ms longer than
specified until the process becomes runnable again. For
the same reason, the value returned in case of a delivered
signal in *rem is usually rounded to the next larger mul­
tiple of 1/HZ s.

As some applications require much more precise pauses
(e.g., in order to control some time-critical hardware),
nanosleep is also capable of short high-precision pauses.
If the process is scheduled under a real-time policy like
SCHED_FIFO or SCHED_RR, then pauses of up to 2 ms will be
performed as busy waits with microsecond precision.

<> at work, <> in private!
"Unix gives you enough rope to shoot yourself in the foot." <>
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:25    [W:0.038 / U:11.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site