The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] shutdown for pre-v7 unix
@ 2014-07-16 19:47 Noel Chiappa
  0 siblings, 0 replies; 17+ messages in thread
From: Noel Chiappa @ 2014-07-16 19:47 UTC (permalink / raw)


    > From: Mark Longridge <cubexyz at gmail.com>

    > I was wondering if there might be a better way to do a shutdown on
    > early unix.

Not really; I don't seem to recall our having one on the MIT V6 machine.

(We did add a 'reboot' system call so we could reboot the machine without
having to take the elevator up to the machine room [the console was on our
floor, and the reboot() call just jumped into the hardware bootstrap], but in
the source it doesn't even bother to do an update(). Well, I should't say
that: I only have the source for the kernel, which doesn't; I don't at the
moment have access to the source for the rest of the system - although I do
have some full dump tapes, once I can work out how to read them. Anyway, so
maybe the user command for rebooting the system did a sync() first.)

I suppose you could set the switch register to 173030 and send a 'kill -1 1',
which IIRC kills of all shells except the one on the console, but somehow
I doubt you're running multi-user anyway... :-)

	Noel



^ permalink raw reply	[flat|nested] 17+ messages in thread
* [TUHS] shutdown for pre-v7 unix
@ 2014-07-17  3:55 Noel Chiappa
  0 siblings, 0 replies; 17+ messages in thread
From: Noel Chiappa @ 2014-07-17  3:55 UTC (permalink / raw)


    > From: Norman Wilson <norman at oclsc.org>

    > I believe that when sync(2) returned, all unflushed I/O had been queued
    > to the device driver, but not necessarily finished

Yes. I have just looked at update() (the internal version of 'sync') again,
and it does three things: writes out super-blocks, any modified inodes, and
(finally) any cached disk blocks (in that order).

In all three cases, the code calls (either directly or indirectly) bwrite(),
the exact operation of which (wait for completion, or merely schedule the
operation) on any given buffer depends on the flag bits on that buffer.

At least one of the cases (the third), it sets the 'ASYNC' bit on the buffer,
i.e. it doesn't wait for the I/O to complete, merely schedules it. For the
first two, though, it looks like it probably waits.

    > so the second sync was just a time-filling no-op. If all the disks were
    > in view, it probably sufficed just to watch them until all the lights
    > ... had stopped blinking.

Yes. If the system is single-user, and you say 'sync', if you wait a bit for
the I/O to complete, any later syncs won't actually do anything.

I don't know of any programmatic way to make sure that all the disk I/O has
completed (although obviously one could be written); even the 'unmount' call
doesn't check to make sure all the I/O is completed (it just calls update()).
Watching the lights was as good as anything.

    > I usually typed sync three or four times myself.

I usually just type it once, wait a moment, and then halt the machine. I've
never experienced disk corruption from so doing.

With modern ginormous disk caches, you might have to wait more than a moment,
but we're talking older machines here...

	Noel



^ permalink raw reply	[flat|nested] 17+ messages in thread
* [TUHS] shutdown for pre-v7 unix
@ 2014-07-17  2:40 Norman Wilson
  0 siblings, 0 replies; 17+ messages in thread
From: Norman Wilson @ 2014-07-17  2:40 UTC (permalink / raw)


After a day and an evening of fighting with modern hardware,
the modern tangle that passes for UNIX nowadays, and modern
e-merchandising, I am too lazy to go look up the details.

But as I remember it, two syncs was indeed probably enough.
I believe that when sync(2) returned, all unflushed I/O had
been queued to the device driver, but not necessarily finished,
so the second sync was just a time-filling no-op.  If all the
disks were in view, it probably sufficed just to watch them
until all the lights (little incandescent bulbs in those days,
not LEDs) had stopped blinking.

I usually typed sync three or four times myself.  It gave me
a comfortable feeling (the opposite of a syncing feeling, I
suppose).  I still occasionally type `sync' to the shell as
a sort of comfort word while thinking about what I'm going
to do next.  Old habits die hard.

(sync; sync; sync)

Norman Wilson
Toronto ON



^ permalink raw reply	[flat|nested] 17+ messages in thread
* [TUHS] shutdown for pre-v7 unix
@ 2014-07-16 18:55 Mark Longridge
  2014-07-16 20:52 ` Brantley Coile
  2014-07-16 21:12 ` Dave Horsfall
  0 siblings, 2 replies; 17+ messages in thread
From: Mark Longridge @ 2014-07-16 18:55 UTC (permalink / raw)


Hi folks,

I've been typing sync;sync at the shell prompt then hitting ctrl-e to
get out of simh to shutdown v5 and v6 unix.

So far this has worked fairly well but I was wondering if there might
be a better way to do a shutdown on early unix.

There's a piece of code for Unix v7 that I came across for doing a shutdown:

http://www.maxhost.org/other/shutdown.c

I doesn't work on pre-v7 unix, but maybe it could be modified to work?

Mark



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-07-18  3:42 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-16 19:47 [TUHS] shutdown for pre-v7 unix Noel Chiappa
  -- strict thread matches above, loose matches on Subject: below --
2014-07-17  3:55 Noel Chiappa
2014-07-17  2:40 Norman Wilson
2014-07-16 18:55 Mark Longridge
2014-07-16 20:52 ` Brantley Coile
2014-07-17  2:29   ` Win Treese
2014-07-16 21:12 ` Dave Horsfall
2014-07-16 21:23   ` Dave Horsfall
2014-07-17  2:09   ` Dan Stromberg
2014-07-17 15:58     ` Warner Losh
2014-07-17 16:15       ` Clem Cole
2014-07-17 18:04         ` Ronald Natalie
2014-07-17 20:16           ` Clem Cole
2014-07-18  2:26             ` Ronald Natalie
2014-07-18  2:52               ` Tim Newsham
2014-07-18  2:58                 ` Milo Velimirovic
2014-07-18  3:42                   ` Warner Losh

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