From mboxrd@z Thu Jan 1 00:00:00 1970 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-reply-to: Your message of "Wed, 28 Nov 2012 08:30:49 EST." <0cf8de222eb5fa81721e8bcf4dd4e875@brasstown.quanstro.net> References: <0263c93c2d57900638e664f1b538a76d@brasstown.quanstro.net> <0cf8de222eb5fa81721e8bcf4dd4e875@brasstown.quanstro.net> Date: Wed, 28 Nov 2012 10:58:27 -0800 From: Bakul Shah Message-Id: <20121128185827.863CFB827@mail.bitblocks.com> Subject: Re: [9fans] sleep(2) historical question Topicbox-Message-UUID: ebb297a8-ead7-11e9-9d60-3106f5b1d025 On Wed, 28 Nov 2012 08:30:49 EST erik quanstrom wrote: > On Wed Nov 28 08:11:43 EST 2012, charles.forsyth@gmail.com wrote: > > No, really, I'm quite serious. A grep of /sys/src/cmd/ suggests that > > most sleeps are relatively large, and arbitrary. Chicken and egg. > > None of the applications look likely to need microsecond let alone > > nanosecond resolution, and that seems reasonable to me. > > One exception is sleep(0), but that's yield() > > you haven't explained how one can emulate a sub-ms > sleep with the edf scheduler. i've got a legit problem. Why not add nsleep() with sleeptime in nanosecond units? And of course, any necessary kernel changes for better accuracy. The whole idea of a kernel HZ clock seems a bit outdated now. If the system has nothing do for the next N seconds, it should may be go into low-power mode & just wait for an interrupt.