Re: Sleeping in nanos
Re: Sleeping in nanos
- Subject: Re: Sleeping in nanos
- From: Graham J Lee <email@hidden>
- Date: Thu, 8 Feb 2007 17:03:58 +0000
On 8 Feb 2007, at 16:47, Greg wrote:
3) On OS X and Linux, right now (and most likely in the distant
future), nanosleep will *NEVER* sleep for less than 1000 nanoseconds.
I think there's a missed point here; even if the above were false you
still wouldn't get the results I think you expect to get. Even if
nanosleep() did truly sleep your thread for exactly one nanosecond,
the time elapsed between the start of the sleep and the scheduler
running your thread again is down to the scheduler, has nothing to do
with your thread, and is pretty much guaranteed to be equal to or
(more likely) greater than the sleep time requested. As it is, due
to hardware limitations it currently takes *much* longer to reawaken
your thread than O(ns), so even a perfectly accurate implementation
of nanosleep() sucks royally ;-)
Cheers,
Graham.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden