What is the difference between interrupt-driven I/O versus polling I/O?

Most input and output devices are much slower than the CPU—so much slower that it would be a terrible waste of the CPU to make it wait for the input devices. For example, compare the speed you can type with the speed the CPU can execute instructions. Even a very fast typist could probably type no more than 10 characters per second, while a modern CPU can execute more than two billion instructions in that same second!

If the CPU simply waits for the next input character, we call this polled I/O. In this method, the CPU continuously polls the I/O device in a program loop, waiting for the next input. Think of a game where a basketball player is asked to make as many free-throws as possible in one minute, but the clock is down the hall in another room. The player must run down the hall and check if the minute has passed, and if not, go back to the gym and try to make another shot, then run down the hall to check the clock and run back to take another shot. The player spends much of the time simply checking (polling) the clock.

An alternative scheme for dealing with I/O is the interrupt-driven method. Here the CPU works on its given tasks continuously. When an input is available, such as when someone types a key on the keyboard, then the CPU is interrupted from its work to take care of the input data. In our example, the basketball player would take shots one after another, while a second person watched the clock down the hall. When the clock reached one minute, the person watching the clock would yell down the hallway for the player to stop. This allows the player to take many more shots, but at the expense of needing someone to watch the clock. Similarly, the CPU can work continuously on a task without checking the input devices, allowing the devices themselves to interrupt it as necessary. This requires some extra "smarts" in the form of electronic circuitry at the I/O devices so that they can interrupt the CPU.

Previous Page Next Page

These pages were written by Steven H. VanderLeest and Jeffrey Nyhoff and edited by Nancy Zylstra
©2005 Calvin University (formerly Calvin College), All Rights Reserved

If you encounter technical errors, contact computing@calvin.edu.