Advanced Caches Flashcards
Ways to improve cache performance
- reduce hit time
- reduce miss rate
- reduce miss penalty
Ways to reduce hit time
- pipelined caches
- Improve TLB time
- Way prediction
- Improve replacement policy time
What are pipelined caches?
Cache accesses are queued, so cannot access the cache while another instruction is accessing it (this can be multiple cycles) ==> instead pipeline the steps to look up an entry in the cache
What is a PIPT cache?
Physically-indexed, physically tagged cache. This cache stores the actual physical address. Processor must look up physical address in TLB and then use that address to get the data in the cache
What are some potential problems with virtually accessed caches?
- Must flush on context switch because VA are specific to a process
- Need other information from TLB on cache hits (such as does this process have permission to access this page)
What is a VIPT cache?
Virtually Indexed - Physically Tagged Cache.
Cache uses virtual index to get physical tag.
At the same time. TLB uses virtual index to get physical tag.
If the tags match, then it is a hit
Do not need to flush on context switch
What is cache aliasing?
In a VIPT cache, multiple virtual addresses might map to the same physical address, but will get store in the cache in different locations (because they are stored based on virtual address)
Why is cache aliasing bad?
On a write, only one location will be updated
How can we ensure that we do not have aliasing?
All of the index bits must come from the page offset. AKA (cache offset) + index <= page offset
What is way prediction?
We try to guess which line in the set has the correct tag. If we miss, we do a normal check of the rest of the lines in the set.
What is the relationship between associativity and hit time?
As associativity goes up, hit rate goes up, but hit time goes up ==> need to balance associativity
What is wrong with LRU and random for replacement polcies?
- Random - nothing to update on cache hit, but has higher miss rate
- LRU - need to update lots of counters on cache hit, but lower miss rate
What are some alternatives for LRU?
NMRU and PLRU
What is PLRU?
Every time a line is accessed, set bit to 1. If we need to remove something, remove a 0. Once all the bits have been set, zero out all bits except the last one. Better than NMRU, not as good as LRU
What are the three types of misses?
Compulsory, capacity (because of limited cache size), and conflict (because of low associativity)