IntermediateTopic 59 of 104Electronics & Embedded
Cache memory
Small fast memory exploiting locality to reduce average access time.
In depth
Caches hold recently used data exploiting temporal and spatial locality. Mapping: direct, set-associative, fully associative. Hit rate determines AMAT=hit time+miss rate×penalty. Write policies: write-through and write-back. Multi-level hierarchy L1/L2/L3.
Key points
- Cache line size
- Coherence in multicore
- Real-time systems may disable caches
ExampleA 95% hit rate with 1 ns hit and 100 ns miss gives about 6 ns average.
What is Cache memory?
Small fast memory exploiting locality to reduce average access time.
Why is it important to understand cache memory?
Caches hide the slow speed of main memory, so their behaviour decides how fast a program runs on real hardware.
What is locality?
Programs tend to reuse recent data (temporal) and nearby data (spatial), which caches exploit to keep most accesses fast.
What is a cache miss?
An access where the data is not in the cache, which forces a slower fetch from the next memory level.
How is Cache memory used in practice?
Typical applications include speeding up a matrix multiply by reordering loops for cache locality, explaining why a small array runs much faster than a large one and choosing a cache size for a low-power processor.
What should I learn before Cache memory?
Study "Pipelining" first (topic 58 of 104 in Electronics & Embedded). It covers the groundwork this topic builds on.
What are the key points of Cache memory?
Cache line size. Coherence in multicore. Real-time systems may disable caches.
Can you give an example of Cache memory?
A 95% hit rate with 1 ns hit and 100 ns miss gives about 6 ns average.
What comes after Cache memory?
The next topic is "Interrupts", which builds directly on this one.
How difficult is Cache memory?
It is classed as Intermediate in Electronics & Embedded (topic 59 of 104). It is an intermediate topic. Work through the beginner topics in Electronics & Embedded first.