Interrupts (Cambridge International IGCSE Computer Science)
Spec point —
4.1.4· 4 Describe the role and operation of interrupts
Interrupts
What is an interrupt?
Exam Hint Cambridge IGCSE 0478 expects you to describe what an interrupt is, explain why they occur, and understand the role of the ISR and stack in managing them. This page focuses only on examinable concepts and uses the terminology seen in real mark schemes.
- 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
Exam Hint In exam answers, always mention that the CPU saves the current state to a stack before executing the ISR. Just saying “the CPU stops” won’t earn full marks, you must include the idea of resuming the original task after the interrupt.
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
Exam Hint Students sometimes say the CPU “loses” or “replaces” data when an interrupt occurs. Wrong.
*Correct: CPU copies register values to a stack *Incorrect: CPU deletes the program or values
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
Was this revision note helpful?