Course outline
- 01How a computer works
- 02How the Internet works
- 03Introducing the GPU
- 04Tensors and models
- 4.1What is a tensor?soon
- 4.2What is an AI model?soon
- 4.3Training vs inferencesoon
- 05Splitting work across GPUs
- 5.1Why split work across GPUs?soon
- 5.2Data parallelismsoon
- 5.3Tensor parallelismsoon
- 5.4Pipeline parallelismsoon
- 5.5Expert parallelismsoon
- 5.6Which to use whensoon
- 06Serving LLMs with vLLM
- 6.1What is LLM serving?soon
- 6.2Meet vLLMsoon
- 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.
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
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.
Sources
This lesson was checked against these pages.