levo

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.

Your recallNot started
Key term

Give three examples of events that would generate an interrupt.

Key term

Explain the role of interrupt priorities.

Questions from this subtopic

Each one with the model answer underneath.

  1. 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. 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. 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. 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. 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. 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.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

If it matches, the search .
succeedsfailsrestarts

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

A0 + 0 gives 0.
B0 + 1 gives 1.
C1 + 1 gives 0 carry 1.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

A global variable means a variable reachable from anywhere in the program.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

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.