Show in graph
CPU

Software → Computer Architecture

Memory Hierarchy

The layered organization of storage from fast small memory to slower larger memory.

Memory hierarchy diagram

Motivation

The memory hierarchy solves the problem that fast memory is expensive and small, while large memory is slower. Computers combine several storage levels to balance speed, size, and cost.

Where it fits

Memory hierarchy connects hardware, computer architecture, operating systems, and performance engineering.

Mental model

Data moves through layers: registers, CPU cache, RAM, disk, and remote storage. The closer data is to the CPU, the faster and smaller that layer usually is.

Common mistakes

  • Treating all memory access as equally expensive.
  • Ignoring cache locality when reasoning about performance.
  • Confusing software caches with CPU caches.

CPU cache, RAM, disk I/O, storage device, latency.