Clicker Training for Engineers

Home > Whimsy > Clicker Training for Engineers

Interrupt vs Polled-Mode I/O

Computer engineers have traditionally had two ways of allowing a computer to interact with the outside world: polled mode or interrupt mode. In polled mode, a computer program regularly checks the state of the outside world and decides if it is appropriate to send or receive information. With interrupt mode, an external event causes the computer to execute a particular piece of a program that will send or receive information.

Polled and interrupt mode have been used for the computer to collect keystrokes from a human who is pressing keys on a keyboard; or to send characters to a printer.

For a fast computer, polled mode is very inefficient. Most of the time the keyboard does not have a new keystroke to give to the computer. The computer sits in a loop-- check for a keystroke; wait a specified amount of time; then check again for a keystroke. With interrupt mode the computer can be busy doing something else until the keyboard interrupts the computer with a new keystroke.

How about the human computer? How does it work with a new puppy around the house? Most humans work in interrupt mode--they are busy with their own work until they hear a crash and run to see what happened. Interrupt mode allows the humans to keep busy with some activity, other than watching the puppy, until it receives a puppy-generated interrupt. Unfortunately, the interrupt is usually an indication that something terrible has happened. The puppy has learned a new, probably undesirable, behavior that the human will have to deal with for the life of the dog.

Preventing undesireable behavior is preferable to trying to eliminate it after it has been learned. For this reason I would recommend that owners of puppies or of recently acquired dogs use the polled mode for human-dog interaction. In polled mode the human checks the state of the puppy at predetermined intervals. This allows the human to catch the puppy being good and to reinforce this desirable behavior. Frequent polling can help prevent undesirable behavior.

Tethering a puppy to a human does permit the human to use interrupt mode to a certain extent. An interrupt will occur when the tether is taute. This can allow the human to redirect the puppy just before it is about to learn an undesirable behavior.

However, tethering has its disadvantages. Depending solely on tether interrupts will not allow the human to reinforce good behavior. That can only be done with polled-mode training. Another disadvantage is that humans are known for turning off interrupts when they are busy running high-priority programs. With the tether interrupt turned off by the human, the puppy will be free to chew through the tether and then go to generate an interrupt that is of higher priority than the currently executing human program.