The process of caching describes the use of buffers to separate operations that differ
significantly in speed, so the fast one is not held up by the slower one (or at least, not
as much). In a system there are many levels of caching that are
used to allow different-speed components to run unimpeded; in the disk subsystem there are
usually two levels.
The disk drive's logic board contains an integral cache.
This cache is used to separate the internal mechanical read/write operations from
transfers over the bus, and to hold recently accessed data. A larger cache will result in
improved performance by cutting down on the required number of physical seeks and
transfers on the platters themselves. Smarter caching algorithms can have the same effect.
In addition to this hardware caching, most operating systems use software disk
caching. Since the system memory is many
orders of magnitude faster than the hard disk, a small area of system memory (usually a
few megabytes) is set aside to buffer requests to the hard disk. When the disk is read,
the data are stored in this cache in case they are needed again in the near future (which
they often are). If they are needed again, they can be supplied from the cache memory
instead of requiring another read of the hard disk.
As with the disk's internal buffer, increasing the size of the cache improves
performance--to a point. If you increase it too much, your operating system will run out
of usable memory for programs and data, and the system will be forced to rely on much
slower virtual memory. In this case your
use of memory as virtual disk is causing the system to also need to use your disk as
virtual memory, defeating your original intent!
In addition to the two typical caches in the hard disk subsystem, some SCSI host
adapters add a third level of cache on the controller itself; these are sometimes called caching
controllers. This cache can be several megabytes in size and logically sits between
any system disk cache and any buffer on the hard disk. Again, this improves performance by
reducing the number of accesses required to the disk. In this case when the system tries
to read data from the hard disk, the controller will intercept the request and if it is in
the cache, satisfy it from there instead of going to the hard disk. This both improves
system speed greatly and also cuts down on traffic on the SCSI bus.
Next: Redundant Arrays of Inexpensive Disks (RAID)