
3.1 Programming Input and Output 95
3.1.3 Busy-Wait I/O
The most basic way to use devices in a program is busy-wait I/O. Devices are
typically slower than the CPU and may require many cycles to complete an opera-
tion. If the CPU is performing multiple operations on a single device,such as writing
several characters to an output device, then it must wait for one operation to com-
plete before starting the next one. (If we try to start writing the second character
before the device has finished with the fir st one, for example,the device will prob-
ably never print the first character.) Asking an I/O device whether it is finished by
reading its status register ...