โ† Computer Organization & Architecture learning path
Computer Organization & Architecture ยท Module 6 of 10

Memory hierarchy and cache

Registers, cache, RAM and disk.

๐Ÿ“– Key ideas

  1. Hierarchy from fastest/smallest to slowest/largest: registers, L1, L2, L3 cache, main memory, SSD/disk.
  2. Locality: temporal (reuse soon) and spatial (nearby addresses) make caches effective.
  3. Mapping: direct-mapped, fully associative and set-associative.
  4. Hit rate and miss penalty give average memory access time: AMAT = hit time + miss rate x miss penalty.
  5. Write policies: write-through and write-back; replacement policies such as LRU.
๐Ÿ’ก Real-life example: Cache is like keeping today's books on your desk instead of walking to the library each time you need one.
Cache hitRequested data found in cache
Spatial localityNearby addresses are likely to be used soon
Set-associative cacheBlock can go in any line of one set
AMATAverage memory access time