6
Programmed I/O
Simple character-at-a-time (byte-at-a-time) I/O is sometimes called programmed I/O to distinguish
it from interrupt-driven I/O or direct memory access (DMA), which we will discuss shortly. With programmed
I/O, the driver checks to see if the device is available (not busy). If so, the driver will write a character
to the buffer on the controller, and command the transfer to begin with a ???set control; clear flag??? (different
computers may name these status bits differently). Set control tells the device to start, and clear flag
makes the device appear busy. The driver then loops, testing for the flag to be set. When the byte
is transferred, the controller will clear the control bit and set the flag bit. The driver will find the flag
bit is set, and that will indicate that the transfer is complete and the device is again available to accept
another character.
The unfortunate characteristic of programmed I/O is that the computer can spend a great deal of time
waiting for a slow device. In the time it takes to process a character out to a 56K baud modem, for example, the
computer could easily perform 200 to 1000 other instructions.
Interrupt-driven I/O
To avoid the waste of computing power using programmed I/O, virtually all operating systems today use
interrupt-driven I/O.
Pages:
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270