Subject: Re: File caching absent?
To: None <l.raiser@deathsdoor.com>
From: Simon Burge <simonb@netbsd.org>
List: netbsd-help
Date: 03/29/2000 22:02:01
Technolord wrote:

> I take as a reference point the linux machine I'm working on where, if I
> do "du", first reads the disk (slow) and the 2nd time it goes at least
> 2x (some cache misses, I guess ;). Under NetBSD if I do du from a
> (relatively) small directory twice it still reads all the data back from
> disk...? 

Is it actually re-reading _all_ the data?  Using csh or tcsh as a shell,
you can see how many I/O's an individual command does using the "time"
built-in command.  For example:

	> time du -s
	192411  .
	0.027u 0.205s 0:04.34 5.0%      0+0k 294+75io 0pf+0w
	> time du -s
	192411  .
	0.018u 0.197s 0:00.21 95.2%     0+0k 0+0io 0pf+0w

"/usr/bin/time -l du -s" will show something similar, only a little more
verbose.

On the first run, there was 294 reads and 75 writes.  For the second
run, everything was still in cache but the HD light flashed again
(probably to update the last access time).

Does using the "noatime" mount option make a difference?  Something
like:

	mount -u -o atime /dev/sd0a /

will update the mount option without needed to reboot (substitute the
device and mount point for whatever you're testing on).

Simon.