9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] sleep(2) historical question
Date: Wed, 28 Nov 2012 08:30:49 -0500	[thread overview]
Message-ID: <0cf8de222eb5fa81721e8bcf4dd4e875@brasstown.quanstro.net> (raw)
In-Reply-To: <CAOw7k5gk+KkeK_B1P-RtXJh+tPeKFnbyCTUb296-OY93-_-kKg@mail.gmail.com>

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.
> 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.

and i don't see why the common case has anything to do
with this.  if you would look at some of the stuff we're doing
at coraid (which has actually been written this decade),
i think you'll find a number of short sleeps.  i've mentioned
before that doing realistic timeouts for aoe in userspace
would require about a 50-100µs sleep, as rtt on 10gbe
is in the neighborhood of 10-40µs.

under the covers, sleep multiplies ms * 1000000 to get ns,
and sets a timer.  it is a trivial thing that doesn't harm
any part of the system to allow one to specifiy ns directly.
this is a 100% artificial limit to resolution.

also, resolution != precision.  and clearly with the type
of hardware we've got, 1µs is going to be about the limit,
and 10µs is going to be the practical limit.  

in 1990 with 20Mhz processors, one couldn't sleep for 1ms,
probablly not even 10ms.

why do extra zeros on the right bother you?  i don't mind them since
the resolution of the interface is an absolute limit on how
short a sleep i can have.  we could if you want specify sleep
in 10µs units, which would accurately reflect todays hardware.
but i'd rather err on the side of too many zeros on the right
than the left.

- erik



  reply	other threads:[~2012-11-28 13:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 23:19 erik quanstrom
2012-11-28  7:37 ` Charles Forsyth
2012-11-28 12:57   ` erik quanstrom
2012-11-28 13:10     ` Charles Forsyth
2012-11-28 13:30       ` erik quanstrom [this message]
2012-11-28 14:35         ` Charles Forsyth
2012-11-28 14:46           ` erik quanstrom
2012-11-28 18:58         ` Bakul Shah
2012-11-28 19:10           ` Charles Forsyth
2012-11-28 19:28             ` erik quanstrom
2012-11-28 18:56               ` cinap_lenrek
2012-11-28 19:38             ` Bakul Shah
2012-11-28 20:58               ` Charles Forsyth
2012-11-28 21:02                 ` erik quanstrom
2012-11-28 21:13                   ` Charles Forsyth
2012-11-28 21:19                     ` erik quanstrom
2012-11-28 21:21                     ` erik quanstrom
2012-11-28 21:43                 ` Bakul Shah
2012-11-29  0:12                   ` Charles Forsyth
2012-11-29  8:12                   ` arnold
2012-11-29  9:19                     ` Charles Forsyth
2012-11-29 15:17                       ` erik quanstrom
2012-11-28 19:27           ` David Arnold
2012-11-28 21:12             ` Charles Forsyth
2012-11-28 19:29           ` erik quanstrom
2012-11-28 19:54             ` Bakul Shah
2012-11-28 19:57               ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0cf8de222eb5fa81721e8bcf4dd4e875@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).