I/O Handling Methods: Interrupt-Driven I/O

  1. In a computer that uses Interrupt-Driven I/O, the CPU can perform other activities while waiting for I/O events.

    An interrupt is a signal that a hardware device issues to the CPU. A device could issue an interrupt in case of an error (such as dividing by 0), but also to indicate that an I/O event is happening.

    When the CPU is interrupted, it pauses the execution of whichever program it currently runs, and instead executes a function called service routine whose purpose is to handle the interrupt. After the service routine returns, the CPU resumes running code from the point where it paused.

    Since each interrupt must be handled differently (depending on the interrupt type,) the service routine uses an array called the interrupt vector that is stored in memory in order to find and call a handler, which is a program that handles a specific type of an interrupt. Each array index contains an address to a handler program.