OCR A-Level Computer Science H446
Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation
Software Development
Types of Programming Language
Exchanging Data
Networks
Web Technologies
Data Types and Number Representation
Data Structures
Boolean Algebra
Legal, Moral, Cultural and Ethical Issues
Elements of Computational Thinking
Problem Solving and Programming
Algorithms
Systems Software
Interrupts and the interrupt service routine
- 2 things to know
- Component 01
Overview
Recall questions on interrupts and why they beat polling, the interrupt service routine, when the interrupt register is checked, saving registers on a stack, the interrupt vector table, priorities, hardware and software interrupts, and scheduling.
What you need to know
Answer each one before you reveal it.
Explain the role of interrupt priorities.
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is an interrupt?
Model answer
A signal sent to the processor from a device, from software, or from the processor's own hardware, indicating that something needs attention. It asks the processor to suspend what it is currently doing and deal with the event before returning to the interrupted work.
- 2
Give three examples of events that would generate an interrupt.
Model answer
Any three of: a key pressed or a mouse moved; a printer signalling that it is out of paper or has finished a job; a hardware timer signalling that a process's time slice has expired; a disk signalling that a requested block of data has arrived; a divide-by-zero or other error detected by the processor; a power failure warning; a software interrupt from a program requesting an operating system service.
- 3
Why are interrupts needed - why not have the processor keep checking each device instead?
Model answer
Repeatedly checking every device (polling) wastes processor time asking devices that have nothing to report, and it delays the response to a device that needs attention urgently. Interrupts let the processor do useful work until a device actually signals, so slow devices can be served promptly without the processor idling or wasting cycles on checks.
- 4
What is an interrupt service routine?
Model answer
A block of code, held in memory as part of the operating system or a device driver, that carries out the action needed to deal with a particular type of interrupt. Each type of interrupt has its own routine, and the addresses of these routines are held in an interrupt vector table so the correct one can be found quickly.
- 5
At exactly what point in the fetch-decode-execute cycle is the interrupt register checked?
Model answer
At the end of the cycle: after the current instruction has been executed and before the next instruction is fetched. This means the current instruction is always allowed to complete, so the processor is never left half way through an instruction with registers in an inconsistent state.
- 6
Describe in order what happens when an interrupt is detected.
Model answer
At the end of the current fetch-decode-execute cycle the processor checks the interrupt register and finds a flag set. It compares the priority of that interrupt with the priority of the task it is running. If the interrupt is higher priority, the contents of the registers - including the program counter - are pushed onto a stack in memory. The address of the appropriate interrupt service routine is loaded into the program counter from the interrupt vector table, and the routine runs. When it finishes, the register contents are popped off the stack and restored, the interrupt flag is reset, and the interrupted program continues from exactly where it left off.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Systems Software, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.