The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: Bakul Shah <bakul@bitblocks.com>
Cc: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] TUHS Digest, Vol 38, Issue 10
Date: Tue, 8 Jan 2019 22:45:31 -0700	[thread overview]
Message-ID: <CANCZdfocjjyFu43JF17iF=woZXvXQzbZpswoL41Pbin7DgJR=Q@mail.gmail.com> (raw)
In-Reply-To: <20190109052004.9DB6F156E410@mail.bitblocks.com>

[-- Attachment #1: Type: text/plain, Size: 4002 bytes --]

On Tue, Jan 8, 2019 at 10:20 PM Bakul Shah <bakul@bitblocks.com> wrote:

> On Wed, 09 Jan 2019 13:10:18 +1100 Dave Horsfall <dave@horsfall.org>
> wrote:
> Dave Horsfall writes:
> > On Tue, 8 Jan 2019, Warner Losh wrote:
> >
> > >       i understood that this implemented the elevator algorithm, and
> > >       possible rotational latency compensation.
> > >
> > >
> > > I know what it does. I want to know why that specific name was
> selected.
> >
> > Err, because as I replied in a previous message (did you not see it?),
> it
> > was up to the programmer to implement an optimal strategy to access the
> > sectors, depending upon the device?  I'm not being snarky, but it seems
> > like an obvious choice (if not a hint) to me...
> >
> > Let's see, I need a strategy to optimise access, taking into account
> > seek and rotational latency.  I know!  I'll call it XXstrategy()!
>
> I too wondered about "strategy" in 1981 when I first worked on
> unix disk drivers. My guess then was something similar.
> Anything other than a FIFO strategy would improve throughput
> or fairness or avoid starvation but was much more complex due
> to the fact you can't reoder reads & writes.  My guess is the
> original author who named it strategy had this in mind.
>

Speaking of origins, it's in the V4 nsys (pre V5) sources we have. It's not
in the V1 or V0 sources we have. I could find no comments in the V4 stuff
or the V5 stuff to give its origin tale.


> But these are not exactly dependent on the vagaries of
> individual disk drivers.  At some point I factoroued out code
> so that each specific disk driver took about 1KB of code and
> shared about 7KB of common code.
>

Yes. Many OSes have factored this out so the code can be shared among the
(now wide variety) of devices out there, as well as tuned for different
work loads.


> > For example, I could envisage a disk where the sectors are deliberately
> > not numbered sequentially i.e. they've taken rotational latency into
> > account for you?
>
> We did in fact use an interleave factor of more than 1 (skip
> more than 1 block for consecutively numbered sectors) to
> improve throughput but that had to do with slow processing.
> We did discuss "dead reckoning" (invoking the service routine
> right when the N+1 numbered sector was near the r/w heads) but
> I don't think we implemented it.
>

 For floppy drivers that I've seen the source to in early unixes, this was
often the case. One minor device would be to access the 'raw' device, while
another would be to access the 'cooked' sector numbers where the mapping
was anything but linear. you'd have an interleave of, say, 4 or so, and
then a 'slip' from track to track. The interleave factor was based on how
much time it took for (a) the disk to rotate and (b) for the OS to process
the sector (plus a little) and the 'slip' from track to track was based on
rotational time and seek time so that when you were doing a sequential
workload the first logical sector in the next track would quickly be under
the read head... All of this was done in the floppy driver.

But there were some drawbacks to this that became clear as a number of
different technologies to access the drive were developed. When you have 6
different floppy controllers, it makes sense to abstract out the bits that
are common to all floppies. When you have 200 disk controllers in 20
different drivers, it makes sense to add a disk layer in there. Add to that
partitioning schemes that are nested, and you quickly realize you don't
want to implement all that in every driver... One of the brilliant
decisions in Unix was to leave all this to the driver and not have the OS
get in the way.... But it was also one that no modern unix or unix-like
system still does due to the extreme diversity of block devices in the
market place today. There are thousands, where the original unix had maybe
a half dozen different ones if you squinted just right... At least
disksort() was abstracted out into a library..

Warner

[-- Attachment #2: Type: text/html, Size: 5052 bytes --]

  reply	other threads:[~2019-01-09  5:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.5.1546912802.21858.tuhs@minnie.tuhs.org>
2019-01-08 10:15 ` Steve Simon
2019-01-08 11:00   ` Andreas Kusalananda Kähäri
2019-01-08 14:58   ` Warner Losh
2019-01-09  2:10     ` Dave Horsfall
2019-01-09  4:23       ` Warner Losh
2019-01-09 19:13         ` Christian Barthel
2019-01-09  5:19       ` Bakul Shah
2019-01-09  5:45         ` Warner Losh [this message]
2019-01-09 15:09           ` Bakul Shah

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='CANCZdfocjjyFu43JF17iF=woZXvXQzbZpswoL41Pbin7DgJR=Q@mail.gmail.com' \
    --to=imp@bsdimp.com \
    --cc=bakul@bitblocks.com \
    --cc=tuhs@tuhs.org \
    /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).