CH 4 e F08
CH 4 e F08
CH 4 e F08
Replacement algorithms are only needed for associative and set associative techniques.
1. Least Recently Used (LRU) – replace the cache line that has been in the cache the
longest with no references to it
2. First-in First-out (FIFO) – replace the cache line that has been in the cache the
longest
3. Least Frequently Used (LFU) – replace the cache line that has experienced the fewest
references
Note2: Simulations have shown that random is only slightly inferior to an algorithms
based on usage
If a cache line has not been modified, then it can be overwritten immediately; however,
if one or more words have been written to a cache line, then main memory must be
updated before replacing the cache line.
• If an I/O module is able to read/write to memory directly, then if the cache has
been modified a memory read cannot happen right away. If memory is written to,
then the cache line becomes invalid.
• If multiple processors each have their own cache, if one processor modifies its
cache, then the cache lines of the other processors could be invalid.
1. write through – this is the simplest technique where all write operations are made to
memory as well as cache ensuring main memory is always valid. This generates a lot of
main memory traffic and creates a potential bottleneck
2. write back – updates are made only to the cache and not to main memory until the
line is replaced
cache coherency – keeps the same word in other caches up to date using some
technique. This is an active field of reseach.
An on-chip cache reduces the processor's external bus activity. Further, an off-chip
cache is usually desirable. This is the typical level 1 (L1) and level 2 (L2) cache design
where the L2 cache is composed of static RAM.
As chip densities have increased, the L2 cache has been moved onto the on-chip area
and an additional L3 cache has been added.
Recent cache designs have gone from a unified cache to a split cache design (one for
instructions and one for data).
2
3
4