9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Re: [sources] 20070413: /rc/bin/cpurc.local
Date: Sun, 15 Apr 2007 13:38:40 -0400	[thread overview]
Message-ID: <20070415173813.F08F71E8C26@holo.morphisms.net> (raw)
In-Reply-To: <9ab217670704151026k6de961c0q1ecd0385c95772c7@mail.gmail.com>

> Additionally, we can't assume it starts off. The value is never
> initialized in the C code, so it could be 0, 1, or 382355318. I'm
> assuming that kencc zeroes uninitialized variables in the text, but
> I'm not sure.

This is just not true.  Global variables in C are guaranteed
to be zeroed at program start time.

> Would be nice to know what it does exactly, and why on earth it uses
> /dev/reboot. Note that there is no way to check the state of the
> variable, so one has no clue if one is enabling or disabling
> 'coopsched', whatever it does this interface is clearly far from
> ideal.

True enough.  The toggle was only so it could be turned off
easily if it was a bad idea, and so that the difference could
be measured.  But it turned out to be a good idea and I never
got around to removing the cruft.  The cruft is now gone
from sources.

The code it controlled in the scheduler did the following.
If process A readies process B to run (say, by writing to a pipe
that process B is reading) and gives up the cpu before
its time slice is up, then process B inherits the rest of
process A's time slice.

This makes concurrent programs (like pipelines, but also 
threaded programs that do a lot of context switching)
get something closer to their fair share of the cpu when
there is scheduling contention.  Inspired by L4.

Russ



  parent reply	other threads:[~2007-04-15 17:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <f93786a38200d44b7406b3181b4e2c20@cat-v.org>
2007-04-15  8:06 ` Uriel
2007-04-15 17:00   ` Uriel
2007-04-15 17:26   ` Devon H. O'Dell
2007-04-15 17:35     ` erik quanstrom
2007-04-15 17:37       ` Devon H. O'Dell
2007-04-15 17:38     ` Russ Cox [this message]
2007-04-15 17:43       ` Uriel
2007-04-15 20:31       ` Devon H. O'Dell
2007-04-15 17:43     ` Devon H. O'Dell
2007-04-15 17:59       ` Russ Cox
2007-04-15 20:34         ` Devon H. O'Dell
2007-04-17  5:21           ` Russ Cox

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=20070415173813.F08F71E8C26@holo.morphisms.net \
    --to=rsc@swtch.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).