I/O Handling Methods: Interrupt-Driven I/O
- As we said from before, with an interrupt-driven I/O approach, the CPU can perform other activities while waiting for the I/O device. After every instruction that the CPU executes, it will check if a signal came via one of its interrupt-request lines. If not, the CPU will continue to execute the next instruction. If yes, the service routine, which the CPU executes, will run an interrupt handler which will handle the I/O operation. We say that:
- A device's controller raises an interrupt.
- The CPU catches the interrupt and dispatches the interrupt handler.
- The interrupt handler clears the interrupt by servicing the device.
Pros: The CPU isn't limited anymore to running just one firmware: it will run other programs until an interrupt occurs.
Cons: Still, frequent I/O requests can reduce the efficiency since the CPU is responsible for handing all the I/O activities.
The flow chart on the next slide illustrates what occurs during an interrupt.