Voodoo Practices
John Woods
john at x.UUCP
Wed May 22 02:38:04 AEST 1985
> <Huh?>
> I have just begun to learn how to hack/program device drivers,
> and I seem to be seeing what might be called "voodoo" practices.
> By "voodoo" I mean practices that are done ``Because they Work''.
> 3 syncs during a reboot.
This one is my favorite nervous habit. I picked it up because I saw
someone else do it. When I finally asked "Why more than one?" I got this
answer: sync() does not wait until the last block leaves the write-behind
cache, it only schedules the blocks for flushing. The second time you type
sync(), the shell requests /bin/sync to be brought in from disk again, and
this read request gets queued AFTER all those write requests. Therefore,
when the second sync() executes, the first sync() is done (and the only
inconsistency is the date of sync(), which gets taken care of in a few
milliseconds). "But why THREE?" "Gee, I don't know......."
I offer the following solution to "But why THREE?". I don't know if it has
any basis in historical fact, but it makes sense (and is therefore suspect).
If your disk is running with an elevator algorithm (requests are stuffed
inside the queue in track order, not merely appended to the end of the queue),
then the second sync might get picked up DURING the write-phase. HOWEVER,
a third sync() will have to wait until the disk head changes direction AND
gets back to that point, by which time all of the write-behind should be gone.
As far as halt doing a sync, it may on the VAX, but the PDP-11 I use at MIT
doesn't have a halt() call (well, it may, but I've never used it...it is 2.9).
Ah, for the days when bootstraps were toggled in by hand! (The MIT-CCC boot
is toggled in by hand, but consists only of stuffing a READ into the disk
register, and starting at 0: the 45 and 70 both do DMA arbitration while the
processor is halted. Thanks, DEC!)
[ The attitude implied here, ``If it don't fit in a 19" relay rack and doesn't
have switches, it isn't a *REAL* computer'', is not the opinion of my
employer, no matter *HOW* much I try to show them the light :-) ]
--
John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101
...!decvax!frog!john, ...!mit-eddie!jfw, jfw%mit-ccc at MIT-XX.ARPA
"MU" said the Sacred Chao...
More information about the Comp.unix.wizards
mailing list