Search
Course outline
  1. 01How a computer works
    1. 1.1What is a computer?(completed)
    2. 1.2The CPU: the brain(completed)
    3. 1.3Memory: RAM vs storage(completed)
    4. 1.4How the CPU and memory work together(completed)
    5. 1.5What happens when you turn on a computer(completed)
  2. 02How the Internet works
    1. 2.1What is the Internet?(completed)
    2. 2.2Addresses and names: IP and DNS(completed)
    3. 2.3Packets: how information travels(completed)
    4. 2.4Client and server: opening a website(completed)
    5. 2.5Inside a busy server(completed)
    6. 2.6Why this matters for AI(completed)
  3. 03Introducing the GPU
    1. 3.1What is a GPU?(completed)
    2. 3.2CPU vs GPU(completed)
    3. 3.3The GPU's own memory: VRAM(completed)
    4. 3.4How the CPU and GPU work together(completed)
    5. 3.5Why GPUs suit AI(completed)
  4. 04Tensors and models
    1. 4.1What is a tensor?soon
    2. 4.2What is an AI model?soon
    3. 4.3Training vs inferencesoon
  5. 05Splitting work across GPUs
    1. 5.1Why split work across GPUs?soon
    2. 5.2Data parallelismsoon
    3. 5.3Tensor parallelismsoon
    4. 5.4Pipeline parallelismsoon
    5. 5.5Expert parallelismsoon
    6. 5.6Which to use whensoon
  6. 06Serving LLMs with vLLM
    1. 6.1What is LLM serving?soon
    2. 6.2Meet vLLMsoon
    3. 6.3Serving a model with vLLMsoon

Lesson 1.3

Memory: RAM vs storage

Why a computer has fast memory that forgets and slow storage that remembers.

beginner 3 min readChecked

In one line

RAM is the computer’s fast, short-term working space that forgets when the power goes off. Storage is slower, much bigger, and remembers.

Real-life analogy

The chef (CPU) does not run to the storeroom for every pinch of salt. Instead, the ingredients for the dishes being cooked right now are laid out on the counter next to the stove. That counter is RAM.

Everything else is kept in the pantry. The pantry is huge and holds food for weeks, but it is further away. That pantry is storage.

At closing time the counter is wiped clean. Whatever was left on it is gone. The pantry is untouched.

Where the comparison stops working: a real counter is not wiped the instant the lights go out. RAM really is: as soon as it loses power, its contents are gone. Also, food leaves the pantry when you use it, but a computer only copies data from storage into RAM. The original stays safe in storage.

Diagram

CPU (the chef)RAM = THE COUNTERVery fastSmallerForgets whenpower goes offSTORAGE = THE PANTRYSlowerMuch biggerRemembers withthe power offloadsaveThe chef works from the counter. Ingredients come from the pantry first.
The CPU works from RAM. Programs and files are loaded from storage into RAM, and saved back to storage to keep them.

Step by step

Have you ever lost a document because the computer crashed before you pressed Save? This lesson explains exactly why that happens.

Two kinds of “memory”

People often say “memory” for two different things. Let’s separate them.

RAM Storage (SSD or hard drive)
Job Holds what you are using right now Keeps files and programs for later
Speed Very fast Much slower than RAM
Size Smaller Much bigger
Power off Forgets everything Remembers

RAM: fast, but it forgets

RAM stands for random access memory. It is where the computer keeps the programs and files you have open at this moment.

RAM is very fast, so the CPU can get what it needs without waiting. But RAM needs power to hold on to data. When the power goes off, everything in RAM disappears. Experts call this volatile memory.

That is why unsaved work is lost in a power cut: it only existed in RAM.

Storage: slower, but it remembers

Storage is where your photos, documents, apps and the operating system live. Common types are SSDs and hard drives.

Storage is much bigger than RAM and it keeps data without power. Turn your laptop off for a month and your photos are still there. But storage is much slower than RAM.

Why have both?

Why not use only one kind?

  • If we used only storage, the CPU would spend most of its time waiting.
  • If we used only RAM, everything would vanish every time you switched off.

So computers use both: storage to keep things safe, and RAM to work on them quickly. When you open a program, the computer loads (copies) it from storage into RAM. When you press Save, it writes your work from RAM back to storage.

What happens when RAM is full?

If you open lots of programs at once, RAM can fill up. The computer then has to keep moving things between RAM and storage to make room. Because storage is slower, everything starts to feel sluggish.

Key takeaways

  • RAM is fast, short-term working space. It forgets when the power goes off.
  • Storage (SSD or hard drive) is slower and bigger, and it remembers.
  • Programs and files are copied from storage into RAM so the CPU can work on them quickly.
  • Saving copies your work from RAM back into storage.

Recap: the chef works from the counter (RAM) because it is close and quick. The pantry (storage) keeps everything safe for later.

Now you understand the difference between RAM and storage, and why pressing Save matters. Next, we will watch the CPU and RAM work together when you open a program.

Quick check

Pick an answer, then press Check answer. Nothing is recorded.

  1. You are writing a long letter and the power suddenly goes off. You had not saved. Why is the letter lost?
  2. Why doesn't the CPU just work directly from storage?
  3. In the restaurant, which one is the pantry?

Sources

This lesson was checked against these pages.

  1. What Is Computer and Laptop RAM and Why Does It Matter? · Intel
  2. Is RAM the Same as Memory? · Corsair
  3. What Is RAM vs. Processor? · Intel