Delay for a fraction of a second in C

Jim Shankland jas at ernie.Berkeley.EDU
Fri Nov 4 09:21:11 AEST 1988


In article <2804 at ingr.UUCP> crossgl at ingr.UUCP (Gordon Cross) writes:
>You are not going to be able to do [sub-second sleeps] without coding
>up some kind of "delay loop" yourself....
>Remember that in the UNIX kernal, scheduled wakeups occur at fixed
>one second intervals.  Thus, unless you are using a non standard kernal, sleeps
>of only whole numbers of seconds are possible!

Never trust statements about the UNIX kernel from people who can't even
spell the word.  Kernel timeouts can occur at 1/HZ second intervals, where HZ
is typically 60 or 100.  The kernel CAN provide a system call to let
processes set alarms at that granularity -- BSD and derivatives do
(setitimer).  SysV-flavored systems just don't bother.  (Or is this
fixed in SysVR3?)

-----
Jim Shankland
jas at ernie.berkeley.edu

"The God I believe in isn't short of cash, MISTER!"



More information about the Comp.lang.c mailing list