Caching

(All data from http://csl.cse.ucsc.edu/~tmk/publications/Usenix96/node11.html)

The simple model is that there is a cache of disk blocks.  Any read-requested block from the disk is first searched for in the block cache.  Only if not found in the block cache must the request go to the disk.  This block cache takes RAM from the system, and reduced the amount of space used for the VM subsystem.

Any block that is to be written is instead stored in the block cache, and is only written if

This has several good features.  The write system call can return immediatly, and the application need not wait.  Many times, the data written belongs to a temporary file, and the file is soon to be deleted.  In this case, the work need not be done at all.  Write caching can be dangerous in an enviornment where disks can be ejected or power might fail.

A more complex caching scheme might have seperate caches for disk blocks, inodes, and directory entries.  Maintaining a size balance between these three can be troublesome.

File caches can have very high hit rates for modest cache size.