< previous page page_286 next page >

Page 286
0286-01.gif
Figure 5.20
Replacement policies.
The replacement policy determines which line to replace when cache is full polices:
d87111c01013bcda00bb8640fdff6754.gif
LRU (Least Recently Used)
d87111c01013bcda00bb8640fdff6754.gif
FIFO (First In-First Out)
d87111c01013bcda00bb8640fdff6754.gif
RAND (Random Replacement)
LRU is generally regarded as the best and most expensive to implent.
RAND is least expensive, but amplifies the miss rate by 12% (average).
d87111c01013bcda00bb8640fdff6754.gif
For various S/370 traces, the FIFO to LRU ratio varies from 0.96 to 1.38.
d87111c01013bcda00bb8640fdff6754.gif
RAND appears to perform about the same as FIFO (with respect to LRU).

2. The number of misses that can be bypassed (or controlled by the cache) while the processor executes. Current implementations do not exceed one bypassed miss.
5.7.2 Line Replacement
The replacement policy determines which line to replace when a miss occurs and the cache is full (Figure 5.20). There are three replacement policies that have been widely discussed and used; these include:
1. Least Recently Used (LRU) Under this policy, the line that was least recently accessed (by a read or write) would be the candidate for replacement.
2. First In-First Out (FIFO) Under this policy, the line that had been in the cache the longest is designated the line to be replaced.
3. Random Replacement (RAND) Under this policy, replacement is determined randomly.
The LRU policy is generally regarded as an ideal policy, since it most closely corresponds to the concept of temporal locality. It is also the most complex to implement, as a counter must be associated with each line and modified on a read (or write) activity. It is possible to create reasonable approximations to the true LRU with small counters.
Generally, for most cache sizes, LRU performs better than either FIFO or RAND. For various traces, RAND appears to perform about the same as FIFO and with a range of between 0.96 and 1.38 relative performance with respect to LRU. An overall average of traces studied indicates that RAND or

 
< previous page page_286 next page >