levo

Systems Software

Interrupts and the interrupt service routine

  • 2 things to know
  • Component 01
Start revising · £5/month

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.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

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

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

If it matches, the search .
succeedsfailsrestarts

Blank Blitz consolidates the facts

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

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

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

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

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.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.