← IGCSE Computer Science Paper 1

Interrupt service routine (ISR)

A small program the CPU runs to deal with one particular interrupt. Each type of interrupt has its own ISR, kept in memory, and it is short so the CPU can quickly return to its task.

Understanding Interrupt service routine (ISR) in IGCSE Computer Science Paper 1

What it does: The OS matches the type of interrupt to the correct ISR and then runs it. The routine does only the few steps needed and then hands control straight back to the interrupted task. An ISR is software. It is the code that handles an interrupt. It is not the device or the signal that causes it. ISRs are stored in memory so the CPU can find and run the right one straight away when an interrupt happens. The operating system works out which type of interrupt has happened and picks the matching ISR to run. A short ISR finishes quickly, so the CPU soon goes back to its original task and the computer stays responsive.

Common mistakes: Each type of interrupt has its own ISR. A printer interrupt must run printer_ISR, not the keyboard ISR. An ISR must be short so the CPU can return quickly. It should end with RETURN TO previous_task, not wait for more keys.

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
Which describes an interrupt service routine (ISR)?
A small program the CPU runs to deal with one particular interruptA device that sends signals to the CPU to ask for attention
Matches
One ISR is used to deal with every type of interrupt
↓
Each type of interrupt has its own ISR, because each one needs different instructions to deal with it.
Applying
Meanings
Term
interrupt service routine (ISR)
Meaning
A small program the CPU runs to deal with one particular interrupt. Each type of interrupt has its own ISR, kept in memory, and it is short so the CPU can quickly return to its task.
Practice
PROCEDURE KeyboardISR()
Testing
Gaps
IF interrupt = KEYBOARD THEN keyISR
Check Answer
Spots
2 KEYBOARD: CALL key_ISR
3 PRINTER: CALL key_ISR

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

The 'Woodpecker' badge — Tap Tap Tap, 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. Which describes an interrupt service routine (ISR)?
A. A device that sends signals to the CPU to ask for attention
B. A small program the CPU runs to deal with one particular interrupt ✓
An ISR is software. It is the code that handles an interrupt. It is not the device or the signal that causes it.
2. How many ISRs are there for the different types of interrupt?
A. One single ISR handles every type of interrupt
B. A different ISR for each type of interrupt ✓
Each type of interrupt, such as a key press or a divide by zero error, needs its own ISR with code suited to that event.
3. Where are ISRs kept so they are ready to run?
A. In memory ✓
B. Only on the keyboard or mouse that causes the interrupt
ISRs are stored in memory so the CPU can find and run the right one straight away when an interrupt happens.
4. Which part of the computer chooses which ISR to run?
A. The operating system ✓
B. The keyboard
The operating system works out which type of interrupt has happened and picks the matching ISR to run.
5. Why is an ISR kept short?
A. So the CPU can return quickly to what it was doing ✓
B. So the ISR can run forever without stopping
A short ISR finishes quickly, so the CPU soon goes back to its original task and the computer stays responsive.

Match the Pairs

ISR → A small program the CPU runs to deal with one particular interrupt
ISR_keyboard() and ISR_printer() → A different ISR for each type of interrupt
The operating system chooses which ISR to run for the interrupt that has occurred → interrupt = printer_error run ISR_printer_error
An ISR is short so the CPU can return quickly to the task it was doing → ISR_keypress read key store in buffer return to task
One ISR is used to deal with every type of interrupt → Each type of interrupt has its own ISR, because each one needs different instructions to deal with it.
The ISR is a long program that takes a long time to finish before the CPU returns to its task → An ISR should be short so the CPU can return quickly to what it was doing.

Key Term

interrupt service routine (ISR)
A small program the CPU runs to deal with one particular interrupt. Each type of interrupt has its own ISR, kept in memory, and it is short so the CPU can quickly return to its task.

Fill in the Blanks

1. IF interrupt = KEYBOARD THEN CALL keyISR
Hint: Type the keyword that runs the routine written for this type of interrupt
2. IF interrupt = MOUSE THEN CALL mouseISR
Hint: Type the interrupt type that matches the ISR being called
3. DECLARE ISRtable : ARRAY[1:5] OF STRING
Hint: Type the data structure keyword used to keep a list of ISRs in memory, ready to run
4. interruptType ← GetInterrupt() CALL ISRtable[interruptType]
Hint: Type the variable that holds which kind of interrupt happened, so the OS can choose the right ISR
5. PROCEDURE mouseISR() OUTPUT "Mouse clicked" ENDPROCEDURE
Hint: Type the keyword that closes this short routine so the CPU can return quickly

Spot the Error

Question 1
A CASE OF interrupt
B KEYBOARD: CALL key_ISR
C PRINTER: CALL key_ISR
D ENDCASE
Line C — Each type of interrupt has its own ISR. A printer interrupt must run printer_ISR, not the keyboard ISR.
Question 2
A PROCEDURE keyboard_ISR()
B READ key FROM keyboard
C ADD key TO input_buffer
D WAIT FOR next_key
E ENDPROCEDURE
Line D — An ISR must be short so the CPU can return quickly. It should end with RETURN TO previous_task, not wait for more keys.
Question 3
A STORE ISR_table IN HARD_DISK
B table[KEYBOARD] ← key_ISR
C table[MOUSE] ← mouse_ISR
Line A — ISRs are kept in memory (RAM) so they are ready to run straight away. A hard disk is too slow to fetch them from.
Question 4
A PROCEDURE timer_ISR()
B WAIT 10 SECONDS
C RESET timer
D ENDPROCEDURE
Line B — An ISR should be short so the CPU can quickly return to its task. Waiting 10 seconds would hold the CPU up. It should be clock ← clock + 1.
Question 5
A IF interrupt = DIVIDE_BY_ZERO THEN
B CALL error_ISR
C ELSE IF interrupt = KEYPRESS
D CALL key_ISR
E ENDIF
Line C — The condition is missing THEN. It should be ELSE IF interrupt = KEYPRESS THEN, so the correct ISR is chosen for each interrupt type.

Student with a class code? Join your class →