netbsd-help: Re: usleep() and system clock resolution

Subject: Re: usleep() and system clock resolution
To: Ruibiao Qiu <ruibiao@arl.wustl.edu>
From: Jason R Thorpe <thorpej@zembu.com>
List: netbsd-help
Date: 05/18/2000 12:21:48
On Thu, May 18, 2000 at 02:13:22PM -0500, Ruibiao Qiu wrote:
 > So, I wonder if usleep() can get to less than 10 ms. Does it has
 > anything to do with system clock resolution? How can I find out
 > the current value of it? How can I configure it? Do I need 
 > to use nanosleep()? (BTW, when I run the tests on a linux box, I
 > got 20 ms :)
Yes, in fact, it has everything to do with the system clock resolution.
The system clock ticks every 10ms, so that is the minimum scheduling
granularity.
Try building your kernel with:
options HZ=256
That would make the granularity slightly less than 5ms, and might work
on a PC.
-- 
 -- Jason R. Thorpe <thorpej@zembu.com>

AltStyle によって変換されたページ (->オリジナル) /