← IGCSE Computer Science Paper 1

Interrupt priority

Each interrupt has a priority level. The CPU handles the most urgent one first, so a power failure can pause the handling of a less urgent key press.

Understanding Interrupt priority in IGCSE Computer Science Paper 1

What it does: The code compares the two priorities and pauses the less urgent ISR so the more urgent interrupt is dealt with first. A power failure is very urgent because the computer may lose data and shut down. A key press can safely wait a moment. The power failure has the higher priority, so it is handled first. How often an event happens does not decide priority; urgency does. A higher priority interrupt can pause a lower priority one. Only the lower priority interrupt waits.

Common mistakes: A power failure has a higher priority number than a key press, so the CPU must handle it first. The test should be powerP > keyP, not <. A power failure is very urgent, so it needs a high priority such as 10. Giving it priority 1 would make it less urgent than a key press, which is wrong.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 409–418) and word search (Modules 390–418).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Two interrupts arrive at the same time. Which one does the CPU handle first?
The interrupt with the higher priorityThe interrupt that is easiest to handle
Matches
Key press (low priority) is handled before a power failure (high priority)
↓
The order is wrong: the CPU handles the higher priority interrupt first, so the power failure should be handled before the key press.
Applying
Meanings
Term
interrupt priority
Meaning
Each interrupt has a priority level. The CPU handles the most urgent one first, so a power failure can pause the handling of a less urgent key press.
Practice
IF power_failure.priority > key_press.priority THEN
Testing
Gaps
IF newPriority currentPriority THEN
Check Answer
Spots
2powerP <- 10
3IF powerP < keyP THEN

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Fox' badge — Cunning Debugger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Two interrupts arrive at the same time. Which one does the CPU handle first?
A. The interrupt with the higher priority ✓
B. The interrupt that is easiest to handle
Each interrupt has a priority. The CPU deals with the most urgent (highest priority) interrupt first.
2. The CPU is handling a low priority interrupt when a higher priority interrupt arrives. What happens?
A. The CPU pauses the low priority one and handles the higher priority one first ✓
B. The CPU ignores the higher priority one until the low priority one has finished
A more urgent interrupt can pause the handling of a less urgent one. The paused interrupt waits and is dealt with afterwards.
3. Which event would normally have the HIGHER priority?
A. A key being pressed on the keyboard
B. A power failure ✓
A power failure is very urgent because the computer may lose data and shut down. A key press can safely wait a moment.
4. Which statement about a lower priority interrupt is correct?
A. It waits, or is paused, while a higher priority interrupt is handled ✓
B. It is deleted for ever when a higher priority interrupt arrives
A lower priority interrupt is not lost. It waits or is paused until the more urgent interrupt has been dealt with.
5. Why do interrupts need priorities?
A. So the CPU handles interrupts in the order the user likes
B. So the CPU deals with the most urgent events first ✓
Priorities let the CPU decide which interrupt is most urgent, so critical events like a power failure are not delayed by minor ones.

Match the Pairs

priority = 1 (power failure) → A high priority interrupt that the CPU must handle first because it is urgent
priority = 5 (key press) → A low priority interrupt that can wait or be paused while a more urgent interrupt is handled
If a higher priority interrupt arrives while a lower priority ISR is running, the CPU pauses the lower one and handles the higher one first → IF new_priority > current_priority THEN pause current ISR
If a new interrupt has a lower priority than the one being handled, it waits until the more urgent interrupt is finished → IF new_priority < current_priority THEN wait
Key press (low priority) is handled before a power failure (high priority) → The order is wrong: the CPU handles the higher priority interrupt first, so the power failure should be handled before the key press.
A power failure interrupt arrives and the CPU ignores it until the key press ISR has finished → The CPU should pause the lower priority key press ISR and handle the higher priority power failure straight away instead of making it wait.

Key Term

interrupt priority
Each interrupt has a priority level. The CPU handles the most urgent one first, so a power failure can pause the handling of a less urgent key press.

Fill in the Blanks

1. IF newPriority > currentPriority THEN pause(currentISR) run(newISR)
Hint: Type the comparison operator that checks whether the new interrupt is more urgent than the current one.
2. IF powerFailure THEN pause(keyPressISR) run(powerFailureISR)
Hint: Type the command that temporarily stops the less urgent key press routine before the urgent one runs.
3. IF powerFailure AND keyPress THEN run(powerFailureISR) wait(keyPressISR)
Hint: Type the command that makes the less urgent routine hold back until the urgent one has been dealt with.
4. IF newPriority <= currentPriority THEN wait(newISR) ENDIF
Hint: Type the operator that tests for a priority that is equal to or lower than the current one.
5. finish(powerFailureISR) resume(keyPressISR) finish(keyPressISR)
Hint: Type the command that carries on with the paused, less urgent routine once the urgent one is finished.

Spot the Error

Question 1
A keyP <- 1
B powerP <- 10
C IF powerP < keyP THEN
D RUN power_ISR first
Line C — A power failure has a higher priority number than a key press, so the CPU must handle it first. The test should be powerP > keyP, not <.
Question 2
A powerP <- 1
B keyP <- 2
C IF powerP > keyP THEN
D RUN power_ISR first
Line A — A power failure is very urgent, so it needs a high priority such as 10. Giving it priority 1 would make it less urgent than a key press, which is wrong.
Question 3
A IF key_press THEN
B PAUSE key_ISR
C RUN power_ISR
D RESUME key_ISR
E ENDIF
Line A — The key press ISR is only paused when a higher priority interrupt arrives. The condition should be power_failure, because a key press is less urgent than the ISR it would be pausing.
Question 4
A IF new_interrupt THEN
B IF newP > currentP THEN
C PAUSE new_ISR
D RUN new_ISR
E ENDIF
F ENDIF
Line C — When the new interrupt has a higher priority, it is the current (lower priority) ISR that must be paused. The line should be PAUSE current_ISR.
Question 5
A IF newP < currentP THEN
B ADD new_ISR TO queue
C CONTINUE current_ISR
D WHEN current_ISR starts
E RUN new_ISR
F ENDIF
Line D — A lower priority interrupt has to wait. It only runs when the current, more urgent ISR has ended, so the line should be WHEN current_ISR ends.

Student with a class code? Join your class →