On Tue, Jun 10, 2008 at 5:39 PM, Stephane Chazelas
<[EMAIL PROTECTED]> wrote:
> Package: manpages-dev
> Version: 2.79-4
> Severity: wishlist
>
>
> The BUGS section in nanosleep(2) gives:
>
> BUGS
>       The current implementation of nanosleep() is based on the
>       normal kernel timer mechanism, which has a resolution of
>       1/HZ s (see time(7)).  Therefore,  nanosleep()  pauses
>       always  for  at least the specified 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 multiple of 1/HZ s.
>
>   Old behavior
>       In order to support applications requiring much more
>       precise pauses (e.g., in order to control some
>       time-critical hardware), nanosleep() would handle  pauses
>       of  up  to 2 ms  by  busy  waiting with microsecond
>       precision when called from a process scheduled under a
>       real-time policy like SCHED_FIFO or SCHED_RR.  This
>       special extension was removed in kernel 2.5.39, hence is
>       still present in current 2.4 kernels, but not in 2.6
>       kernels.
>
>       In Linux 2.4, if nanosleep() is stopped by a signal
>       (e.g., SIGTSTP), then the call fails with the error EINTR
>       after the process is resumed by a SIGCONT signal.   If
>       the system call is subsequently restarted, then the time
>       that the process spent in the stopped state is not
>       counted against the sleep interval.
>
>
> I think it should be worth mentionning that since 2.6.16, on
> some architectures, the kernel can be configured with high
> resolution timers which makes nanosleep(2) a lot more accurate
> and voids the first comment above.

Stephane

Thanks for your note.  Can you provide some further details -- for
example, can you tell me any of the following:
which architectures?
what config options are required?
what determines the accuracy that can be achieved with HR timers?

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to