2020 21 7b

Computer Organization and Architecture2020-2110 marksModes of Data Transfer

Discuss the different modes of data transfer.

Discuss the different modes of data transfer.

Quick answer

Data transfer between the CPU, memory and I/O devices is done in three modes. They differ in how much work the CPU does and how fast the transfer is.

Programmed I/O

The CPU controls the whole transfer by a program. It checks the status flag of the device in a loop. When the flag shows ready, the CPU reads or writes the data register. After that it goes back to checking.

This is simple and needs little hardware. But the CPU is kept busy waiting. This is called busy waiting, and it wastes CPU time, especially when the device is slow.

Interrupt-initiated I/O

Here the CPU does not wait. The device sends an interrupt signal when it is ready. The CPU stops its program, saves its state, and runs the service routine that moves the data. Then it returns to the old program.

The CPU can therefore run other programs while the device is busy. The overhead is the time to save and restore the state for every word. So this mode is good for slow or medium speed devices such as keyboards, but not for large blocks of data.

Direct Memory Access (DMA)

The DMA controller moves blocks of data between the device and memory by itself. The CPU only sets up the start address and word count, and the controller interrupts the CPU at the end. Data goes straight over the system bus, so the CPU is free during the transfer.

DMA is the fastest mode and is used for disks, tapes and network cards. It needs extra hardware, and the controller and the CPU compete for the memory bus.

Comparison

PointProgrammed I/OInterrupt-initiated I/ODMA
Who moves the dataCPUCPUDMA controller
CPU waitingBusy waitsFree until interruptFree for whole block
SpeedSlowestMediumFastest
Hardware costLowestMediumHighest
Unit of workOne wordOne wordA block
Best forSimple, fast-responding tasksSlow devicesDisks and bulk data

A simple illustration

Think of a student waiting for a parcel. In programmed I/O, the student stands at the gate and keeps looking out. In interrupt-initiated I/O, the student studies and goes to the gate only when the doorbell rings. In DMA, a helper collects all the parcels and places them in the room, and tells the student only when the last one is in.

Choosing a mode

If the device is slow and the system is simple, programmed I/O is enough. If the CPU has other jobs to do, interrupts are better. If large amounts of data must move quickly, DMA is the best choice.

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

Up nextDefine the term Computer Architecture.