Memory hierarchy and caches
Small fast memories (registers, caches) sit in front of large slow ones (RAM, SSD) to exploit locality.
Edited by Alex C, EduAlx · Sources cited below
Explanation
Temporal locality: recently used data is reused. Spatial locality: nearby data is used next. L1 cache access is about 1 ns, RAM about 100 ns, SSD tens of microseconds. Cache misses are compulsory, capacity or conflict. Wilkes proposed caches ('slave memories', 1965).
Example
How it works, step by step
- CPU requests an address
- Check L1, then L2, L3
- On miss, fetch a cache line from RAM
- Replace a line (LRU-like policy)
Open the interactive page with diagrams →
People behind it
- Maurice Wilkes
References
- M. V. Wilkes, IEEE Trans. Electron. Comput. 1965, EC-14, 270–271.
Textbooks
- Computer Organization and Design, David A. Patterson, John L. Hennessy (Morgan Kaufmann, RISC-V ed., 2nd ed. 2020). Standard computer architecture text.
- Modern Operating Systems, Andrew S. Tanenbaum, Herbert Bos (Pearson, 5th ed. 2022). Classic OS text.
Related topics
Pipelining and parallel processorsVon Neumann architectureBoolean logic and digital circuitsAutomata and formal languagesFile systems and storageString algorithms and pattern matchingVirtualisation and containersGreedy algorithms and minimum spanning treesCloud computingHeaps and priority queues