What does sync() _really_ do?

Horst Laumer hotte at sunrise.in-berlin.de
Mon Dec 17 19:39:50 AEST 1990


steinar at ifi.uio.no (Steinar Kj{rnsr|d) writes:


>The above subject and imposed question may seem trivial, but I have so far
>failed to find the answer (I browsed through the 4.3 book by McKusick, Karels
>and Quarterman, references to pertinent pages here are welcome). The question
>arised when a disk vendor presented results from a benchmark which purpose
>was to measure read/write transfer rates for his drive. His scenario
>was this:

> - a stand alone BSD (SunOS 4.0.3 I think) box in single user mode
> - no other disk activity in the system

>The test program looked something like this:

> - <write a HUUUUGE file and measure the write transfer rate>
> - sync(); sync(); sync();
> - <read the same file back again and measure the read transfer rate>
> 

As stated in the AT&T SysV Programmer, sync(2) is used to write memory
to disk *and* actualize the superblock. Thus, the succeeding read()
ought to find the file correctly, because the last blocks and superblock
where flushed to disk. sync(1/1M) is simply the same, but as stand-alone
binary.

--HL
-- 
============================================================================
Horst Laumer, Kantstrasse 107, D-1000 Berlin 12 ! Bang-Adress: Junk-Food 
INET: hotte at sunrise.in-berlin.de                ! for Autorouters -- me --
UUCP: ..unido!fub!geminix!sunrise.in-berlin.de!hotte



More information about the Comp.unix.internals mailing list