The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Bakul Shah <bakul@iitbombay.org>
To: Rudi Blom <rudi.j.blom@gmail.com>
Cc: tuhs@tuhs.org
Subject: [TUHS] Re: Clever code
Date: Tue, 13 Dec 2022 07:52:49 -0800	[thread overview]
Message-ID: <29888CC6-CA23-4361-BC9C-1B8A775C8DA9@iitbombay.org> (raw)
In-Reply-To: <CAMYpm85A7ACZ1mYRjrKDNNRVPh-wnZVXAN=bkjr6FXHeeM2suw@mail.gmail.com>

On Dec 12, 2022, at 7:30 PM, Rudi Blom <rudi.j.blom@gmail.com> wrote:
> 
> I vaguely remember having read here about 'clever code' which took into account the time a magnetic drum needed to rotate in order to optimise access.

Similar consideration applied in the early days of unix workstations.
Fortune 32:16 was a 5.6Mhz machine and couldn't process 1020KB/sec
(17 sectors/track of early ST412/ST506 disks) fast enough. As Warner
said, one dealt with it by formatting the disk so that the logical
blocks N & N+1 (from the OS PoV) were physically more than 1 sector
apart. No clever coding needed!

The "clever" coding we did was to use all 17 sectors rather than 16
+ 1 spare as was intended. Since our first disks were only 5MB in
size, we wanted to use all the space and typical error rate is much
less than 6%. This complicated handling bad blocks and slowed things
down as blocks with soft read errors were copied to blocks at the
very end of the disk. I don't recall whose idea it was but I was the
one who implemented it. I had an especially bad disk for testing on
which I used to build V7 kernels....

> Similarly I can imagine that with resource restraints you sometimes need to be clever in order to get your program to fit. Of course, any such cleverness needs extra documentation.

One has to be careful here as resource constraints change over time.
An optimization for rev N h/w can be a *pessimization* for later revs.
Even if you document code, people tend to leave "working code" alone.

> I only ever programmed in user space but even then without lots of comment in my code I may already start wondering what I did after only a few months past.

Over time comments tend to turn into fake news! Always go to the
primary sources!

  parent reply	other threads:[~2022-12-13 15:54 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13  3:30 Rudi Blom
2022-12-13  3:41 ` Warner Losh
2022-12-13  3:53 ` Dave Horsfall
2022-12-13  4:03   ` George Michaelson
2022-12-13  8:05     ` Ralph Corderoy
2022-12-13  9:45       ` Dagobert Michelsen
2022-12-13  7:47   ` Ralph Corderoy
2022-12-13 19:56     ` Dave Horsfall
2022-12-13 11:46   ` John P. Linderman
2022-12-13 14:07     ` Douglas McIlroy
2022-12-13 14:31       ` arnold
2022-12-13 14:48         ` Ralph Corderoy
2022-12-13 15:10         ` Douglas McIlroy
2022-12-13 15:34           ` Stuff Received
2022-12-13 15:56             ` Ralph Corderoy
2022-12-13 23:02           ` Harald Arnesen
2022-12-14  7:31           ` arnold
2022-12-15 18:06           ` Marc Donner
2022-12-15 18:08             ` Marc Donner
2022-12-15  6:30         ` [TUHS] Delay line memory (was: Clever code) Greg 'groggy' Lehey
2022-12-13 15:52 ` Bakul Shah [this message]
2022-12-13 16:14   ` [TUHS] Re: Clever code Ralph Corderoy
2022-12-13 16:30     ` Bakul Shah
2022-12-15  6:39   ` [TUHS] Sector interleaving (was: Clever code) Greg 'groggy' Lehey
  -- strict thread matches above, loose matches on Subject: below --
2022-12-13 18:02 [TUHS] Re: Clever code Noel Chiappa
2022-12-13 17:58 Noel Chiappa
2022-12-13 18:51 ` G. Branden Robinson
2022-12-13 20:14   ` segaloco via TUHS
2022-12-13 20:58     ` Warren Toomey via TUHS
2022-12-14  2:28     ` Luther Johnson
2022-12-11 20:03 [TUHS] Re: Stdin Redirect in Cu History/Alternatives? Larry McVoy
2022-12-12  2:15 ` [TUHS] Clever code (was " Bakul Shah
2022-12-12  9:48   ` [TUHS] Re: Clever code Michael Kjörling

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=29888CC6-CA23-4361-BC9C-1B8A775C8DA9@iitbombay.org \
    --to=bakul@iitbombay.org \
    --cc=rudi.j.blom@gmail.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).