KS3 · Computer Science
The fetch–decode–execute cycle
Every game, video and message on your computer comes down to one tiny loop: get an instruction, work out what it means, do it. Then again. Let's slow it down.
Computer Science · Inside the CPU
Follow the program counter
Three instructions sit one after another in main memory: address 0 holds LOAD from 7, address 1 holds ADD 5, address 2 holds STORE to 7. Address 7 holds the data value 20. This is a simple model, so the names inside a real CPU may differ.
Before you press Next: the program counter holds 0. What will it hold straight after the first instruction has been fetched?
Phase: Fetch — instruction 1
Program counter
0
Instruction fetched
LOAD from 7
Decoded as
—
ALU
—
Register
—
Address 7
20
Output
Step 1: The program counter says 0. That 0 isn't an instruction and it isn't a score — it's an ADDRESS. So the CPU goes to address 0 in main memory and fetches whatever is stored there: LOAD from 7.
Press Next one step at a time. Keep your eye on the program counter — when exactly does it change?
Who does what?
Match each job to the part of the CPU that does it
Pick a job, then choose the part of the CPU that does it.
Still to sort
Control unit (0)
Works out what to do and directs the cycle.
Where the line is: The control unit works out what needs doing; the ALU does the actual sums and comparisons.
ALU (0)
Arithmetic logic unit: the arithmetic and logic.
Where the line is: The ALU gets to work at execute, once the control unit has decoded the instruction.
Registers (0)
Very small, very fast storage inside the CPU.
Where the line is: Registers are inside the CPU. The program itself is stored outside the CPU, in main memory.
Clock (0)
Sets the pace of the cycle.
Where the line is: The clock keeps the timing; it doesn't decode anything, work anything out or count instructions.
Predict, then check
Two CPUs are identical in every way except their clock speed. CPU A runs at 1.5 GHz. CPU B runs at 3 GHz. Same program on both.
Which CPU gets through more instructions each second?
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Get it, work out what it means, do it — then go round again.
What you need to know
- A program's instructions, and the data it works on, are both stored in main memory (RAM).
- Every memory location has an address — a number that says where it is, a bit like a house number.
Have a goAddress 7 holds the number 20. Which of those two numbers is the address, and which is the data?
7 is the address (where); 20 is the data (what's stored there).
The address only says where to look — the value sitting there can change, as when a 20 becomes a 25, while the address stays 7.
- The CPU runs a program by repeating the fetch–decode–execute cycle, one instruction after another, many times every second.
- Fetch: the CPU uses the address in the program counter to get the next instruction from main memory.
- Straight after the fetch, the program counter goes up so it points to the next instruction.
Have a goEach instruction takes one address. The program counter shows 41 and the CPU fetches. Your friend bets you a biscuit it still shows 41. Take the bet?
Take it — straight after the fetch it shows 42.
41 is used first to find the instruction, then the counter goes up to point at the next one. 41 is only right before the fetch.
- Decode: the control unit works out what the instruction means and what the CPU needs to do.
- Execute: the CPU carries it out — the ALU calculates or compares, or data moves between memory and the CPU. Then it's back to fetch.
Have a goAn instruction says 'compare 8 and 3'. At which stage does the comparing happen, and which part of the CPU does it?
At execute, by the ALU.
Decode only works out that a comparison is needed; actually comparing the numbers is the ALU's job once the instruction is executed.
- The control unit directs the whole cycle. Registers, like the program counter, are tiny, very fast stores inside the CPU.
- The clock sets the pace. Clock speed, measured in hertz, is how many clock cycles the CPU can carry out each second.
- Higher clock speed means more instructions processed each second.
The big picture
Instructions and data sit in main memory, each at its own address. The CPU runs a program by going round one loop: fetch the instruction at the program counter's address (the counter then goes up), decode it in the control unit, execute it — the ALU calculates or compares, or data moves. Then back to fetch. Registers are tiny, fast stores inside the CPU; the clock sets the pace, and clock speed in hertz is clock cycles per second. A higher clock speed means more instructions can be processed each second.
Key points
Worked example
Problem
The program counter holds 12. The instruction stored at address 12 tells the CPU to compare two numbers to find out which is bigger. Each instruction in this program takes up one address. Describe what happens at each stage of one fetch–decode–execute cycle, and say what the program counter holds at the end.
⚠ Watch out
Treating the program counter as the instruction itself — or as a count of instructions run. It holds an address. The other big one: thinking a lower clock speed number means a faster CPU. Clock speed is cycles per second, so a bigger number means more cycles each second.
Memory hook
Fetch it, decode it, do it — then go again. And the program counter is a bookmark: it marks WHERE to read next, not what's written there.
Check yourself
Cover the page and talk it through out loud: one full trip round the cycle for ADD 5 — what the program counter, the control unit and the ALU each do.
Flashcards
(14)What is stored in main memory while a program runs?
What is a memory address?
What does the program counter hold?
When does the program counter go up?
What happens at the fetch stage?
What happens at the decode stage, and which part does it?
What happens at the execute stage?
What happens straight after execute?
What does ALU stand for, and what does it do?
What two jobs does the control unit do in the cycle?
What are registers?
What does the clock do?
What is clock speed, and what is it measured in?
What does a higher clock speed mean?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore KS3 Computer Science topics
How this lesson was checked. This KS3 Computer Sciencelesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 27 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.