Page 186 -
P. 186
156 CHAPTER 4 / CACHE MEMORY
1.0
0.8 Strong
locality
0.6
Moderate
Hit ratio
locality
0.4
No locality
0.2
0.0
0.0 0.2 0.4 0.6 0.8 1.0
Relative memory size (S 1 /S 2 )
Figure 4.24 Hit Ratio as a Function of Relative Memory Size
memory access time (i.e., T /T is 5 to 10), off-chip cache access time is about 5 to 15
1
2
times faster than main memory access time (i.e., T /T is 5 to 15), and main memory
1
2
access time is about 1000 times faster than disk access time (T /T = 1000). Thus, a
2
1
hit ratio in the range of near 0.9 would seem to be needed to satisfy the performance
requirement.
We can now phrase the question about relative memory size more exactly. Is a
hit ratio of, say, 0.8 or better reasonable for S 1 V S ? This will depend on a number
2
of factors, including the nature of the software being executed and the details of the
design of the two-level memory.The main determinant is, of course, the degree of lo-
cality. Figure 4.24 suggests the effect that locality has on the hit ratio. Clearly, if M1
is the same size as M2, then the hit ratio will be 1.0:All of the items in M2 are always
stored also in M1. Now suppose that there is no locality; that is, references are com-
pletely random. In that case the hit ratio should be a strictly linear function of the
relative memory size. For example, if M1 is half the size of M2, then at any time half
of the items from M2 are also in M1 and the hit ratio will be 0.5. In practice, how-
ever, there is some degree of locality in the references. The effects of moderate and
strong locality are indicated in the figure. Note that Figure 4.24 is not derived from
any specific data or model; the figure suggests the type of performance that is seen
with various degrees of locality.
So if there is strong locality, it is possible to achieve high values of hit ratio
even with relatively small upper-level memory size. For example, numerous studies
have shown that rather small cache sizes will yield a hit ratio above 0.75 regardless
of the size of main memory (e.g., [AGAR89], [PRZY88], [STRE83], and [SMIT82]).

