Computer Science I / Input-Output and Peripheral Communication
Practice question · Put in order

Order what happens when a device signals the CPU with an interrupt.

Hints
  1. The whole benefit of interrupts happens between the request and the signal.
  2. State must be preserved before the handler runs, or the interrupted work could not resume.
Show the answer
  1. The CPU issues its request to the device and carries on with other work
  2. The device finishes and raises an interrupt signal
  3. The CPU pauses and saves its current state
  4. The interrupt handler runs and deals with the device
  5. The CPU restores its state and resumes where it left off
Why

The CPU does not wait: it requests, works on something else, and is called back. Saving state before the handler and restoring it afterwards is what makes the interruption invisible to the interrupted program. Putting the save after the handler would destroy the work being resumed.

Read the lesson: Input-Output and Peripheral Communication →

Practise Input-Output and Peripheral Communication

The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Input-Output and Peripheral Communication