Date: Tue, 6 Jun 1995 10:55:28 +1000 From: Bruce Evans <bde@zeta.org.au> To: bde@zeta.org.au, freebsd-hackers@FreeBSD.ORG, james@miller.cs.uwm.edu Subject: Re: Interval timer/System clock Message-ID: <199506060055.KAA17115@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>> I "fixed" hzto() by adding 1 to allow for the current partial clock tick. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >I looked at the code this morning and I am a little curious as to why >this was changed. There are 3 places in the kern directory where hzto() >is called. Two places are for the real time timers and the other is for >the select system call. >If I subtract 1 from hzto() in these 3 places -- the timing seems correct. This breaks sleep() again. sleep(n) shall sleep at least n seconds (POSIX spec), but if the 1 is added then sleep(n) is only guaranteed to sleep at least (n - 1/hz) seconds; it sleeps an average of about (n - 1/(2*hz)) seconds for random calls and about (n - (time for sleep() call)) seconds for calls in a loop. >I am curious why the 1 tick was added to hzto()? I can subtract one from See above. >the hzto in kern_time.c and sys_generic.c but wouldn't it make more sense >to have hzto() return 1 less inorder to get the correct hz values for time? No. hzto() is better placed than most callers to someday handle the partial tick more accurately. Only realitexpire() is better placed. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199506060055.KAA17115>