How computers and the internet work / Inside a computer
CPU, RAM, and storage
Follow one program from disk into memory and through the processor.
Estimated time: 15 minutes
Learning outcome
By the end of this lesson, you will be able to explain how a program moves from your hard drive into memory and through the CPU, and why each step matters for speed.
Where your data lives
Your computer has three main places to store information. Think of them like a kitchen:
- Storage (hard drive or SSD) is your pantry. It holds everything you own — recipes, ingredients, spices. It is large but slow to reach into.
- RAM (memory) is your countertop. It holds what you are working with right now. Much faster than the pantry, but only a small amount of space.
- CPU (processor) is the cook. It does the actual work. It has its own tiny built-in workspace called registers, which are the fastest of all.
When you open a program, the operating system copies it from the slow pantry (storage) onto the countertop (RAM). Then it feeds small pieces to the cook (CPU) one at a time.
flowchart TD A[Disk / SSD<br/>Pantry - big, slow] -->|load program| B[RAM<br/>Countertop - medium, fast] B -->|feed instructions| C[CPU<br/>Cook - small, very fast] C -->|read/write| B B -->|save file| A
What each part does
Storage
Storage keeps your files, programs, and operating system when the power is off. There are two common types:
- HDD (hard disk drive): a spinning metal platter with a tiny arm that reads data. Like a record player. Cheap for large amounts, but slow.
- SSD (solid state drive): no moving parts. Uses flash memory, like a USB stick but faster and more reliable. More expensive per gigabyte, but much faster.
Most modern laptops use SSDs. If you have an older computer, it might have an HDD.
RAM
RAM stands for Random Access Memory. It is fast, but it forgets everything when you turn off the computer. That is why your unsaved work disappears in a power outage.
Every program you have open — your browser, your code editor, your music player — takes up space in RAM. If you run out of RAM, the computer starts using storage as pretend-RAM (called swapping), which makes everything slow.
CPU
The CPU (Central Processing Unit) executes instructions. It has a clock speed measured in gigahertz (GHz), which tells you how many billions of operations it can do per second.
A CPU has multiple cores. Each core can work on a different task. A 4-core CPU can do four things at once (roughly). This is why having more cores helps with multitasking.
Worked example: opening a calculator
- You double-click the calculator icon.
- The operating system finds the calculator program on your SSD.
- It copies the program from the SSD into RAM (this takes maybe a second).
- The CPU starts reading calculator instructions from RAM.
- You press a button. The CPU receives the signal, does the math, and sends the result to the screen.
Every step in this chain is limited by the slowest part. If your SSD is slow, the program takes longer to open. If your RAM is full, the CPU spends time waiting.
Common beginner mistakes
- Confusing storage with memory. Storage is where files live permanently. Memory (RAM) is where active work happens. Having a large hard drive does not make your computer faster.
- Buying too much storage and too little RAM. For programming, 8 GB of RAM is a comfortable minimum. 16 GB is better. Storage is cheaper to upgrade later.
- Thinking CPU speed is everything. A fast CPU with slow RAM and an old HDD will still feel sluggish. The whole system matters.
Practice task
Open Task Manager (Windows) or Activity Monitor (Mac). Look at how much RAM you are using right now. Close a few programs and watch the number drop. Open a large program and watch it rise.
Recap
- Storage (HDD/SSD) holds data permanently but is slow.
- RAM holds active data temporarily and is medium-fast.
- CPU does the work and needs everything fed to it from RAM.
- The slowest component in this chain determines overall speed.
Next step
Now that you know how a computer runs a program, the next lesson traces what happens when you open a website — from your browser to a server somewhere in the world.