Direct Memory Access (DMA)

DMA allows an I/O-device to send or receive data directly to or from the Main Memory, bypassing the CPU to speed up memory operations.

Importance of DMAs

DMAs offloads the CPU from the task of handling basic memory copy operations.

Learnt this briefly in ECE222.

The DMA function can be performed by a separate module on the system bus, or it can be incorporated into an I/O module. In either case, the technique works as follows. When the processor wishes to read or write a block of data, it issues a command to the DMA module by sending the following information:

  • Whether a read or write is requested
  • The address of the I/O device involved
  • The starting location in memory to read data from or write data to
  • The number of words to be read or written

The processor then continues with other work. It has delegated this I/O operation to the DMA module, and that module will take care of it.

The DMA module transfers the entire block of data, one word at a time, directly to or from memory without going through the processor.

When the transfer is complete, the DMA module sends an interrupt signal to the processor.

The processor

The processor is involved only at the beginning and end of the transfer.

The DMA module needs to take control of the bus to transfer data to and from memory. Because of this competition for bus usage, there may be times when the processor needs the bus and must wait for the DMA module.

Note this is not an interrupt; the processor does not save a context and do something else. Rather, the processor pauses for one bus cycle (the time it takes to transfer one word across the bus).

The overall effect is to cause the processor to execute more slowly during a DMA transfer when processor access to the bus is required. Nevertheless, for a multiple-word I/O transfer, DMA is far more efficient than interrupt-driven or programmed I/O.