9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: rog@vitanuova.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] thread confusion
Date: Mon, 26 Sep 2005 20:20:33 +0100	[thread overview]
Message-ID: <9cca1b36a501f3b3b6878dcadab89e98@vitanuova.com> (raw)
In-Reply-To: <ee9e417a05092611523dba7636@mail.gmail.com>

> What if we did without the timer variable?

sure.  as you say, it's pretty much equivalent.  the only thing that
troubles me is that the Occam version uses absolute timestamps, where
yours are relative.

when dealing with short intervals of time, given that scheduling is
somewhat arbitrary, the difference between:

	# do something every microsecond (relative timeout)
	for(;;){
		alt{
		timeout 1 =>
			# do something
		}
	}

and:

	# do something every microsecond (absolute timeout)
	t := now();
	for(;;){
		alt{
		timeout t =>
			# do something;
			t++;
		}
	}

might be significant.  the former version allows errors to accumulate,
where the latter does not.  having calculated the timeout necessary
for the alt, you never know exactly when it is going to acually start;
a relative timeout is inevitably inaccurate.

i think that might be one of the reasons why the transputer folks (who
thought quite hard about things) chose absolute over relative timeouts.

> Once you've figured out what a good interface is, implementing
> it is subtle and difficult to get right.  But it only needs to be done
> right once and then everyone benefits.  Channel communication
> is complicated too under the hood, but it's still a good abstraction.

i agree totally. this was my motivation in posting.



  reply	other threads:[~2005-09-26 19:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-21 14:44 Fco. J. Ballesteros
2005-09-21 15:05 ` Axel Belinfante
2005-09-21 15:42   ` Russ Cox
2005-09-21 20:25     ` Axel Belinfante
2005-09-21 20:32       ` Axel Belinfante
2005-09-21 20:37       ` Russ Cox
2005-09-21 22:34         ` Axel Belinfante
2005-09-21 22:44           ` Russ Cox
2005-09-26 18:40       ` rog
2005-09-26 18:52         ` Russ Cox
2005-09-26 19:20           ` rog [this message]
2005-09-27 10:12         ` Axel Belinfante
  -- strict thread matches above, loose matches on Subject: below --
2005-09-21 15:48 Fco. J. Ballesteros
2005-09-21 13:53 Fco. J. Ballesteros
2005-09-21 14:32 ` Axel Belinfante
2005-09-21 13:25 Axel Belinfante

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=9cca1b36a501f3b3b6878dcadab89e98@vitanuova.com \
    --to=rog@vitanuova.com \
    --cc=9fans@cse.psu.edu \
    /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).