An interrupt is a signal sent to the processor to indicate that an event requires immediate attention. The processor suspends its current task, handles the interrupt, then resumes.
Generated by hardware devices signalling they need attention.
Generated by programs requesting OS services or on exception.
Generated periodically by a hardware timer chip.
A table stored in memory that maps each interrupt number to the memory address of its ISR. When an interrupt occurs, the CPU looks up the IVT to find where to jump.
| Int # | ISR Address |
|---|---|
| 0x00 | 0x0040 (Divide by zero) |
| 0x08 | 0x1200 (Timer) |
| 0x09 | 0x1500 (Keyboard) |
| 0x21 | 0x2000 (System call) |
A specialised piece of code that handles a specific type of interrupt. Each interrupt type has its own ISR stored in memory. The ISR runs, then control returns to the interrupted program.
; Keyboard ISR example
READ_PORT keyboard_port
STORE key_buffer
SET keyboard_flag
IRET ; return from interrupt
Can be disabled (masked) by the processor — e.g. during a critical section of code that must not be interrupted. The processor sets a flag to ignore these.
Example: keyboard interrupt can be masked during a database write.
Cannot be disabled — always handled immediately, regardless of the processor's interrupt mask.
Examples: hardware failure, memory parity error, power failure detection, critical safety systems.
Step through the interrupt handling sequence. Click Generate Interrupt to begin, then Next Step to advance.
(empty)
CPU is executing the main program normally.
Is each scenario a Hardware, Software, or Timer interrupt?
1. Describe the sequence of events that occurs when a processor receives an interrupt, from the point the interrupt flag is detected to the point the original program resumes. [6 marks]
Mark scheme — max 6:
2. Explain the role of the Interrupt Vector Table (IVT). [2 marks]
Mark scheme:
3. A processor supports both maskable and non-maskable interrupts. Explain the difference and give one example of when a non-maskable interrupt would be used. [3 marks]
Mark scheme:
4. Explain how timer interrupts are used to achieve multitasking in an operating system. [3 marks]
Mark scheme: