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

A tiny program is stored in main memory. Address 0 holds LOAD from 7, address 1 holds ADD 5 and address 2 holds STORE to 7. Address 7 holds a piece of data: the number 20. Step through and watch the CPU run it, one cycle at a time.

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 holds 0. That's not an instruction and it's not a count — it's an ADDRESS. So the CPU goes to address 0 in main memory and fetches the instruction stored there: LOAD from 7.

1 / 13

Use Next to move one step at a time. Keep your eye on the program counter box — when does it change?

Step 1 of 13: The program counter holds 0. That's not an instruction and it's not a count — it's an ADDRESS. So the CPU goes to address 0 in main memory and fetches the instruction stored there: LOAD from 7..

Check your thinking

What is the program counter actually holding?

A program starts at address 0 and runs in order. The CPU has just fetched the instruction at address 4, and the program counter now shows 5.

Which is closest to what you think that 5 means?
How sure are you?

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)

Decides what happens 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: does the arithmetic and logic.

Where the line is: The ALU only acts 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 sets HOW FAST the cycle runs; the control unit directs WHAT happens in it.

7 of 7 still to sort.

Rebuild it, then break it

Why does the cycle need every stage?

2 stages are missing. Use the rest of the loop to work out which goes where.

  1. Stage 1: Reading the program counter

    The CPU looks at the address held in the program counter.

  2. Stage 2: Fetching the instruction

    The instruction stored at that address in main memory is brought into the CPU.

  3. Stage 5: Executing

    The instruction is carried out — the ALU calculates or compares, or data moves between memory and the CPU.

…and stage 5 leads back to stage 1.

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.

Which one can carry out more fetch–decode–execute cycles each second, and by how much?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

One tiny loop, repeated over and over — it's how every program on your computer actually runs.

What you need to know

  • A program's instructions, and the data it uses, are stored in main memory (RAM). Every memory location has an address — a number that says where it is.
  • The CPU runs a program by repeating the fetch–decode–execute cycle, one instruction after another, many times every second.
  • Fetch: the CPU gets the next instruction from main memory, using the address held in the program counter. The program counter is then increased so it points to the next instruction.
  • Decode: the control unit works out what the instruction means and what the CPU needs to do. Execute: the CPU carries it out — for example the ALU does a calculation or comparison, or data moves between memory and the CPU.
  • Clock speed is measured in hertz (for example gigahertz, GHz). It is the number of cycles the CPU can carry out each second.

The big picture

A program is a list of instructions stored at addresses in main memory. The CPU runs it by repeating the fetch–decode–execute cycle: fetch the instruction at the address in the program counter (which then increases), decode it in the control unit, execute it — for example in the ALU — and go round again. The clock sets the pace, and clock speed is the number of cycles each second.

Key points

1The program counter holds an address — where the next instruction is. It does not hold the instruction, and it does not count how many instructions have run.
2The program counter moves on straight after the fetch, before the instruction has been decoded or executed.
3The control unit directs the cycle and decodes instructions. The ALU (arithmetic logic unit) does arithmetic and logic, such as adding and comparing.
4Registers are very small, very fast storage places inside the CPU. The program counter is one of them.
5Not every instruction needs the ALU: some just move data between main memory and the CPU.
6The clock sets the pace of the cycle. A higher clock speed means more cycles each second, so more instructions can be processed each second.

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

Saying the program counter holds the next instruction, or that it counts how many instructions have been run. It holds the ADDRESS of the next instruction to fetch — and it increases straight after each fetch, not at the end of the cycle.

🧠

Memory hook

Fetch it, decode it, do it — then go again. And think of the program counter as a bookmark: it marks WHERE to read next, not what's written there.

✓

Check yourself

The program counter holds 8. Without looking back: which address does the next instruction come from, what does the program counter hold straight after that fetch, and which part decodes it?

Flashcards

(14)
What is stored in main memory while a program runs?
The program's instructions and the data it uses — each at its own memory location.
What is a memory address?
A number that identifies one location in main memory — it says where something is stored.
What does the program counter hold?
The address of the next instruction to fetch. Not the instruction itself, and not a count of instructions run.
When does the program counter increase?
During fetch — straight after the instruction has been fetched, so it points to the next one.
What happens at the fetch stage?
The CPU gets the next instruction from main memory, using the address held in the program counter.
What happens at the decode stage, and which part does it?
The control unit works out what the instruction means and what the CPU needs to do.
What happens at the execute stage?
The instruction is carried out — for example the ALU calculates or compares, or data moves between memory and the CPU.
What happens straight after execute?
The cycle starts again with the next fetch.
What does ALU stand for, and what does it do?
Arithmetic logic unit. It does arithmetic and logic operations, such as adding and comparing.
What two jobs does the control unit do in the cycle?
It directs the cycle, and it decodes instructions.
What are registers?
Very small, very fast storage places inside the CPU. The program counter is one.
What does the clock do?
It sets the pace of the fetch–decode–execute cycle.
What is clock speed, and what is it measured in?
The number of cycles the CPU can carry out each second, measured in hertz — for example gigahertz (GHz).
Why can a CPU with a higher clock speed process more instructions each second?
It carries out more cycles each second, and each cycle processes an instruction.

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 posted

More KS3 Computer Science topics

See the full KS3 Computer Science curriculum →

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 30 September 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.