← 🏛️ Memory Hierarchy & Main Memory
Subtopic 1 of 7

7.1Hierarchy

The idea

The memory hierarchy stacks memories from tiny-and-fast to huge-and-slow so the CPU usually finds data in the fast ones.

Think of it like this: Pocket, desk, bookshelf, library: ever bigger, ever slower.

Why it exists

No technology is fast, large and cheap at the same time; a hierarchy gives the illusion of all three.

How it works

  1. Registers → L1 → L2/L3 → DRAM → disk.
  2. Going down: capacity ↑, access time ↑, cost per bit ↓.
  3. It works thanks to locality of reference.
  4. Data moves between levels in blocks or pages.

Worked example: Typical times

Register ~0.3 ns, L1 ~1 ns, DRAM ~60–100 ns, SSD ~100 µs, HDD ~5–10 ms.

Now play with it

  • →Click each level to see its typical size and speed.

Going down: capacity ↑, access time ↑, cost per bit ↓, frequency of access ↓.

Rough typical figures, to build intuition (ratios matter, not exact values).

Check yourself

Going down the memory hierarchy, which quantity decreases?

Remember: Faster means smaller and costlier per bit.
Exam notes (the dense version)

Registers → L1 → L2/L3 → Main memory (DRAM) → Disk. Going down: bigger, slower, cheaper per bit. Works because of locality.

Previous year questions: Memory Hierarchy & Main Memory (16)

PYQs are grouped by topic, so this is the full set for Memory Hierarchy & Main Memory; try the ones that match this subtopic. Open all 16 on the topic page.