The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: imp@bsdimp.com (Warner Losh)
Subject: [TUHS] shutdown for pre-v7 unix
Date: Thu, 17 Jul 2014 09:58:52 -0600	[thread overview]
Message-ID: <699EC97F-61D6-4102-99E1-8752E8CBD381@bsdimp.com> (raw)
In-Reply-To: <CAGGBd_ocQ_NouK7upV9YE119i8N2M1dqunJ1bG4HV4N7Awf-uA@mail.gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]


On Jul 16, 2014, at 8:09 PM, Dan Stromberg <drsalists at gmail.com> wrote:

> On Wed, Jul 16, 2014 at 2:12 PM, Dave Horsfall <dave at horsfall.org> wrote:
>> On Wed, 16 Jul 2014, Mark Longridge wrote:
>> 
>>> 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.
>> 
>> The "correct" way used to be:
>> 
>>    sync
>>    sync
>>    sync
> 
> 3 sync's was net.wisdom for a long time, but some discussions in the
> Linux mailing lists suggested that 2 was enough all along.
> 
> The first schedules all dirty buffers to be flushed to disk.
> 
> The second does the same, but to provide an ordering guarantee,
> doesn't return until the dirty buffers from the first are finished.
> 
> Hence the 2.
> 
> But I'm a relative newcomer to *ix - I didn't get involved until SunOS 4.

But it wasn’t about the ordering…

The reason three syncs were recommended was that you needed time to pass to flush the buffers, and some early versions would only schedule the I/O and not wait for it to actually complete before returning. Later versions waited, but by then the disks had buffers of their own that would get missed up if you didn’t wait a smidge before turning them off. So what the second two syncs really accomplished was the passage of time before you did anything stupid.

I’m not so sure about the “ordering guarantee” logic presented in that thread. There’s no “barrier” that the first sync puts in that the second sync waits for. Earlier discussions have suggested the first sync flushes all the dirty blocks and sent out the superblock marked dirty as well. The second sync would see no I/O has happened and send out the superblock clean. And the third sync was because of {lots of theories here}, but mostly was for the passage of time to keep the rule simple.

Warner

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20140717/e5a7d0a4/attachment.sig>


  reply	other threads:[~2014-07-17 15:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
2014-07-16 19:47 Noel Chiappa
2014-07-17  2:40 Norman Wilson
2014-07-17  3:55 Noel Chiappa

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=699EC97F-61D6-4102-99E1-8752E8CBD381@bsdimp.com \
    --to=imp@bsdimp.com \
    /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).