Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Sep 1998 12:00:56 -0400
From:      "Steve Friedrich" <SteveFriedrich@Hot-Shot.com>
To:        "angelayu" <angelayu@stlinux.ouhk.edu.hk>, "freebsd-questions@FreeBSD.ORG" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: meaning
Message-ID:  <199809121600.MAA13931@laker.net>

next in thread | raw e-mail | index | archive | help
On Sat, 12 Sep 1998 14:28:17 +0800 (HKT), angelayu wrote:

>syncing disks  ...3 2 done

Unix type operating systems use main memory to "buffer" file write
operations, in order to increase performance.  Say you have a file that
requires 5 blocks on the hard disk.  Say you're editing that file, with
an editor, and you command the editor to  write the file.  A write
operation to a mechanical device like a hard disk takes milliseconds to
perform because the "head" has to be positioned before the write can
occur.  But a write operation to main memory only takes microseconds. 
So, to increase performance, an operating system can "buffer" the write
to main memory, making your application, in this case the editor,
believe that it has actually been written to the disk, and when several
blocks have accumulated in the "buffer", the operating system will
write several in one operation.  Unix style operating systems call this
section of main memory used for this purpose, a "buffer cache".  This
buffer cache is constructed in software, and should not be confused
with a CPU's level 1 (L1) or level 2 (L2) cache, which are constructed
in hardware.

This buffer cache must be written to the actual hard disk before you
turn off your computer.  That's why unix style operating systems have a
shutdown command.  When you see:

>syncing disks  ...3 2 done

the operating system is "flushing" the buffer cache to the hard disk so
you don't lose this info.  Where you see the first "3", it's informing
you that it has three disk blocks to write, then it says "2" disk
blocks to write, and finally it reports it has written all blocks by
displaying "done".  The numbers vary each time you shutdown, and
nothing is wrong as long as it finally says "done".  If you don't see
"done", that's a bad thing, and when you boot the operating system the
next time, you need to "fsck" the disks.  "fsck" stands for file system
check and you can read about it in the manual page (type "man fsck" at
a unix prompt) or in books that discuss unix system administration.

Other operating systems have adopted this performance enhancement as
well.  Any time you get around a new operating system, check to see if
it has a "shutdown" command.  DOS got people into a bad habit of just
clicking the "off" switch.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809121600.MAA13931>