Interrupts (Cambridge (CIE) O Level Computer Science)
Revision Note
Written by: Robert Hampton
Reviewed by: James Woodhouse
Interrupts
What is an interrupt?
An interrupt is a signal for the CPU to stop what it is currently doing and do something else as a higher priority
The CPU is in a continuous loop of carrying out the fetch-decode-execute cycle, however there are occasions when this needs to be interrupted
How is an interrupt generated?
An interrupt can be generated by hardware and software:
Hardware - this is caused by a hardware device such as a hardware failure
Software - this occurs when an application stops or requests services from the OS
Interrupts are added to an area called the interrupt service routine
The interrupt service routine holds instructions that will need to be fetched, decoded and executed to complete the commands of the interrupt
The contents of the registers within the CPU cannot be lost by an interrupt, so contents are copied to a reserved area in RAM called a stack
Contents are added to the top of the stack, which will save them for later retrieval when the interrupt is complete
The interrupt will be executed instead of the original instructions
What are examples of hardware interrupts?
Hardware
power button may have been pressed
moving the mouse
clicking an icon to open a new program
keyboard presses e.g. ctrl, alt, delete
What are examples of software interrupts?
Software
a program is not responding
division by zero
two processes trying to access the same memory location
Examiner Tips and Tricks
The main focus of interrupts is the importance of the interrupt service routine and the role it plays in moving current instructions to the stack so that they can be interrupted BUT continue again afterwards
Worked Example
Describe the purpose of an interrupt in a computer system
[4]
Answer
Four from:
Used to attend to certain tasks/issues
Used to make sure that vital tasks are dealt with immediately
The interrupt/signal tells the CPU/processor (that its attention is required)
A signal that can be sent from a device (attached to the computer)
A signal that can be sent from software (installed on the computer)
The interrupt will cause the OS/current process to pause
The OS/CPU/ISR will service/handle the interrupt
They have different levels of priority
After the interrupt is serviced, the (previous) process is continued
It enables multi-tasking to be carried out on a computer
A valid example of an interrupt e.g. ‘out of paper’ message for a printer
Last updated:
You've read 0 of your 5 free revision notes this week
Sign up now. It’s free!
Did this page help you?