Received: by ATHENA-PO-2.MIT.EDU (5.45/4.7) id AA00546; Wed, 6 Dec 89 17:03:14 EST
Received: from ANUBIS.MIT.EDU by ATHENA.MIT.EDU with SMTP
	id AA00989; Wed, 6 Dec 89 17:03:05 EST
Received: by anubis.MIT.EDU (5.61/4.7) id AA18707; Wed, 6 Dec 89 17:02:59 -0500
Date: Wed, 6 Dec 89 17:02:59 -0500
From: Bill Sommerfeld <wesommer@ATHENA.MIT.EDU>
Message-Id: <8912062202.AA18707@anubis.MIT.EDU>
To: irbusch@ATHENA.MIT.EDU
Cc: Bill Sommerfeld <wesommer@ATHENA.MIT.EDU>
In-Reply-To: Ian R Busch's message of Wed, 06 Dec 89 15:23:13 EST,
	<8912062023.AA12981@M7-321-7.MIT.EDU>
Subject: Caching.

In the context of computer systems, caching is a generic term for to
using a expensive, small, fast memory to front for a cheap, large,
slower memory, to provide the illusion of a cheap, large, fast memory.
In this case, cost, speed, and size are relative.

This is based on the observation that typical memory access patterns
are localized-you tend to reference memory locations near where you
last referenced.  If your cache size is large enough, you can get
"cache hit" rates of over 90%

Welcome to the world of multiple level storage systems:

Many higher-end systems such as the DECstation 3100 or VAX 3600 have a
small memory of perhaps 64KB which is much faster (and more expensive
per bit) than main memory of perhaps 8MB ; using a cache could
increase *average* performance by perhaps 50% or more while increasing
cost only by 5-10% or so.  With some modern microprocessors, there are
often two levels of caches: a memory of perhaps 256 bytes to as much
as 8K on the chip, and a larger cache off-chip; the off-chip cache can
be omitted for cheaper systems.

Similarly, main memory is significantly faster than winchester disks;
most UNIX systems allocate somewhere around 10% of system memory as a
"buffer cache" for disk accesses, so that repeated reads or writes of
files and directories typically go to the buffer cache rather than the
disk; the 1MB cache is much faster, but much smaller, than the 40MB
disk.

And again, local disk is typically faster than network access to a
remote disk; AFS uses perhaps 10MB of the local disk as a cache for
remote access, to front for gigabytes of information available across
multiple servers.  When reading a file which is in the on-disk cache,
it can make the bits available faster and without loading down shared
resources (the file server and network).

So, in fetching a byte from a file in AFS, you go through a number of
caches:

	- the on-disk cache for remote fileservers living on the local
	  disk.
	- the buffer cache for disk living in main memory.
	- the cache for main memory in a small, fast memory (if the
			system has one)

Many of these topics are covered in 6.004 and 6.033.

					- Bill


