</>
ShikshaCSLearn. Code. Grow.
🔍
☕ Support Us
ShikshaCSâ€ēNotesâ€ēComputer Architecture
Computer Architecture
🕒 6 min read

Memory Hierarchy

Why your computer uses many types of memory instead of just one.

Why a Hierarchy?

Faster memory (like CPU registers) is very expensive and small, while slower memory (like hard disks) is cheap and large. The memory hierarchy balances speed and cost by layering different memory types.

The Levels

From fastest/smallest to slowest/largest: Registers (inside the CPU), Cache (L1, L2, L3), Main Memory (RAM), and Secondary Storage (SSD/HDD). Data frequently used gets promoted to faster levels.

Locality of Reference

Programs tend to access the same data or nearby data repeatedly (locality of reference). Caches exploit this by keeping recently/frequently used data close to the CPU, dramatically speeding up execution.

🌍 Real-World Use

When your laptop feels slow after opening too many apps, it's often because RAM is full and the OS starts using the much-slower disk as 'virtual memory' — this is memory hierarchy in action, visibly affecting your experience.

💡 Pro Tip

Remember the order (fastest to slowest) using: 'Rich Cats Rarely Sleep' — Registers, Cache, RAM, Secondary storage — helpful for quick recall in exams.

đŸ§Ē Quick Self-Test

Check what you just learned — no pressure, just practice.

1. Which memory type is fastest but smallest?

2. What principle do caches rely on?

← Back to all Notes