Course Content
Part 1: The Basics of RAM
Random Access Memory is one of the most fundamental elements of modern computer.
0/2
Part 5 – Operating Systems and RAM
Now, we are switching gears. Instead of looking at RAM only as little circuits, we are going to see it from the software side — that is, how the operating system (the big boss software like Windows, macOS, Linux, or Android) uses RAM to run programs smoothly.
0/3
Let’s Understand Random Access Memory: The Key to How Your Computer Thinks Fast

🔄 Quick Recap

So far, we’ve traveled step by step through the memory world:

  • Registers (Lesson 12): The CPU’s instant memory.

  • Caches (Lesson 13): L1, L2, and L3 — the mini-fridges and pantries right next to the CPU.

  • RAM (Lessons 9–11): The fast but larger counter in the kitchen.

  • Storage (earlier lessons): Hard drives and SSDs — like supermarkets far away.

Now, it’s time to bring it all together into the memory hierarchy — a pyramid that shows all the memory types, ordered by speed and size.

 

🏛️ What is the Memory Hierarchy?

The memory hierarchy is the layered system of storage inside a computer, from the fastest and smallest to the slowest and biggest.

👉 The rule is simple:

  • The closer memory is to the CPU, the faster it is.

  • The farther memory is from the CPU, the bigger it is.

Think of it as different food storage places for a chef:

  • Spices in hand → Registers.

  • Spice jars on cutting board → L1 Cache.

  • Spice rack → L2 Cache.

  • Pantry → L3 Cache.

  • Kitchen counter → RAM.

  • Supermarket → SSD or Hard Drive.

  • Warehouse → Cloud storage or external drives.

 

 

Memory Type Typical Size Speed (Latency)
Registers Bytes <1 ns
L1 Cache 32–128 KB 1–2 ns
L2 Cache 256 KB–2 MB 3–10 ns
L3 Cache 4–64 MB 10–30 ns
RAM (DDR4/5) GBs 50–100 ns
SSD (NVMe) 500 GB–2 TB 0.1 ms (100,000 ns)
HDD 1–10 TB 5–10 ms
Cloud Virtually unlimited

Depends on internet (50–200 ms)

 

👉 Notice: Registers and caches work in nanoseconds (billionths of a second), while hard drives and cloud storage are in milliseconds (thousandths of a second). That’s a million times slower!

 

📖 Real-World Example: Opening a Video File

When you double-click to play a movie:

  1. Storage (SSD/HDD): The video file is first read from your drive.

  2. RAM: The file is copied into RAM so the CPU can access it quickly.

  3. Cache: Frequently used chunks (like the next few frames) are stored in cache.

  4. Registers: As the CPU decodes video, actual numbers being calculated (like pixel colors) sit inside registers.

This layered system ensures smooth playback. If you relied only on the hard drive, video would stutter badly.

 

🎮 Example in Gaming

When you play a game:

  • Character location and health values → stored in registers/cache.

  • Level map and enemy AI → stored in RAM.

  • Game files (textures, sounds) → stored on SSD.

The hierarchy ensures only the most urgent data is nearest to the CPU.

 

📉 Trade-Offs in the Hierarchy

The memory hierarchy balances three factors:

  1. Speed – How quickly data can be accessed.

  2. Size – How much data can be stored.

  3. Cost – How expensive it is to build.

Registers are lightning fast but extremely expensive per byte, so you can only have a few. Hard drives are cheap per byte, but they’re slow.

That’s why the hierarchy exists — it’s the only way to balance performance and cost.

 

🔮 Future Directions

  • 3D-stacked memory (HBM, 3D V-Cache): Makes cache layers bigger and closer.

  • Non-volatile RAM (NVRAM, MRAM, ReRAM): Combines RAM speed with storage persistence.

  • Universal Memory (dream): One memory type to replace all layers (research ongoing).

 

📝 Recap

  • The memory hierarchy arranges all computer memory by speed, size, and cost.

  • Closest to CPU: Registers, Caches (L1, L2, L3).

  • Middle ground: RAM.

  • Farther away: SSDs, HDDs, Cloud.

  • The pyramid ensures smooth performance without wasting money on making everything as fast as registers.

  • Future memory may shrink this gap, but the hierarchy remains essential.

 

0% Complete