Practice question · Put in order
Order what happens when a device signals the CPU with an interrupt.
- The CPU restores its state and resumes where it left off
- The CPU pauses and saves its current state
- The device finishes and raises an interrupt signal
- The interrupt handler runs and deals with the device
- The CPU issues its request to the device and carries on with other work
Hints
- The whole benefit of interrupts happens between the request and the signal.
- State must be preserved before the handler runs, or the interrupted work could not resume.
Show the answer
- The CPU issues its request to the device and carries on with other work
- The device finishes and raises an interrupt signal
- The CPU pauses and saves its current state
- The interrupt handler runs and deals with the device
- 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.
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
- Polling, interrupts and DMA all move data between a device and memory. Why does adding DMA improve throughput…
- Sort each peripheral by the direction in which data mainly flows.
- A DMA controller writes data into memory while the CPU holds an older copy of that region in its cache. What…
- Match each mechanism or component to what it does.
- Select every statement that is a genuine advantage of interrupts over polling.