Lectures 9 & 10 - The Memory Hierachy Flashcards
Which caches are separate?
L1 data and L1 instruction caches. This allows access to data memory and instruction memory in the same cycle. Characteristics can also then be optimised for contents.
Which caches are unified?
L2/L3 caches are typically unified. Allows the proportion of memory dedicated to instructions and data to be dynamically adjusted depending on program requirements.
Blocks or Cache Lines
Blocks help us exploit spatial locality of data. On a cache miss we must load a minimum of one block of data from main memory into the cache.
Block Size - Optimal
Larger block size allows us to better exploit spatial locality - reduces miss rate.
Increasing block size decreases number of different blocks that can be stored. - increases miss rate
Large block size - increases miss rate.
Direct Mapped Cache
Each block has only one place it can be stored in the cache. Low-access time but may suffer from many collisions meaning cache lines may be repeatedly evicted despite free entries.
Set Associative Cache
Each block can be in n differrent places in cache.
Fully associative cache (using cams also known as CAM-tag or CAM-RAN cache)
Highly associative caches often seen in embedded systems where energy consumption is a major concern. They reduce miss rates avoiding high cost of accessing main memory.
Block Replacement Policies
Want to use invalid lines in the set if possible. Otherwise use LRU scheme or approximate LRU by FIFO or Not Last Used.
Write-Allocate
Allocate block in cache and then write
No-write allocate
Just write to lower-level memory
Write through
Write to both cache and lower level of memory when we perform a write.
Write Back
Only write dirty cache blocks to lower level of memory when they are replaced.
Average Memory Access Time
Hit Time + Miss Rate x Miss Penalty
Compulsory Cache Miss
Generated when a block is brought into the cache for the first time.
Capacity
Capacity misses are produced when the number of blocks required by a program exceeds the capacity of the cache.