2023 24 2e

Computer Organization and Architecture2023-247 marksModes of Data Transfer

What are the basic differences between interrupt initiated I/O and programmed I/O? Explain in detail.

What are the basic differences between interrupt initiated I/O and programmed I/O? Explain in detail.

Quick answer

Programmed I/O and interrupt-initiated I/O are two ways in which the CPU controls the transfer of data to and from an I/O device. They differ mostly in how the CPU learns that the device is ready.

Programmed I/O

The CPU runs a program that tests the status flag of the device again and again in a loop. This is called polling. When the flag shows "ready", the CPU transfers one word between the device and a CPU register. Then it goes back to polling for the next word.

The CPU does nothing useful while it waits. It is therefore tied up for the entire time the device takes. The method needs little hardware and is easy to program. It is used when the system has a single job or when the device is very fast.

Interrupt-initiated I/O

Here the CPU starts the device and then goes on with other work. When the device is ready, its interface sends an interrupt request. The CPU completes its current instruction, saves the return address and the flags, and jumps to the interrupt service routine. The routine moves one word, and the CPU returns to the interrupted program.

The CPU is not kept waiting, so it is used well when devices are slow. The cost is the time spent in saving and restoring the state for each interrupt, and the extra hardware for interrupt handling and priority.

Differences

PointProgrammed I/OInterrupt-initiated I/O
Who finds that the device is readyCPU, by polling the flagDevice, by an interrupt signal
CPU useWasted in busy waitingFree for other work meanwhile
Response timeDepends on the polling loopFast, as the interrupt is served at once
HardwareSimpleNeeds interrupt logic and priority
Overhead per wordTest of the flagSaving and restoring state
SoftwareSimple loopNeeds a service routine
EfficiencyPoor for slow devicesGood for slow and medium devices
Typical useSmall embedded systemsKeyboard, mouse, timer

Summary

Programmed I/O is simple but wasteful, because the CPU stays in a loop. Interrupt-initiated I/O uses the CPU much better because the device calls the CPU when needed. Neither is suited to moving big blocks of data at high speed. For that, DMA is used, since in both of these methods the CPU must handle every word.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.

Up nextWhat do you mean by processor organization? Explain various types of processor organizatio