DMA - Direct Memory Access

In this course, we will study direct memory access(DMA), the modes of transferring the information, direct memory access(DMA) controller, the working of the DMA controller, and the advantages and disadvantages of the DMA controller.

What is DMA (direct memory access)?

Whenever we have to access memory we have to first go to CPU and then CPU goes to memory. But in DMA(direct memory access) we can directly access the memory from the input/output device.

We can define it as Direct Memory Access (DMA) transfers the block of data between the memory and peripheral devices of the system, without the participation of the processor. There is a unit that controls the activity of accessing memory directly and is called a DMA controller.
The DMA controller takes over the buses by the following two commands:


What are the modes of transferring the information?

There are three possible ways in which the information can be transferred from the CPU to the external devices.

  1. Programmed i/o
  2. Interrupt initiated i/o
  3. Direct memory access

What is programmed i/o?

It is due to the result of the I/O instructions that are written in the program. The transfer of each data item is initiated by an instruction in the program. The CPU register and memory do the transfer. In this case, constant monitoring is required by the CPU of the peripheral devices.

What is interrupt initiated i/o?

The situation where the CPU is kept busy unnecessarily can very well be avoided by using an interrupt-driven method for data transfer. We can use the interrupt facility and special commands to inform the interface to issue an interrupt request signal so that whenever the data is available from any device.

The CPU can proceed for any other program execution in the meantime. The device is monitored by the interface. Whenever the device is ready for data transfer it initiates an interrupt request signal to the computer. Upon detection of an interrupt signal, the CPU stops the task that it was already performing. And branches to the service program to process the I/O transfer and then returns to the task it was originally doing.

What is a DMA controller?

DMA controller provides an interface between the bus and the input-output devices. Although it transfers data without the intervention of the processor, it is controlled by the processor. The processor initiates the DMA controller by sending the starting address, Number of words in the data block, and direction of transfer of data .i.e. from I/O devices to the memory or from main memory to I/O devices. More than one external device can be connected to the DMA controller.

There are three modes in which the DMA controller transfers the data:

Burst Mode

In this, when the DMA controller gains the charge of the system bus, then it releases the system bus only when there is a complete data transfer. Till then the CPU has to wait for the system buses.

Cycle Stealing Mode

In this mode, the DMA controller forces the CPU to stop its operation and relinquish the control over the bus for a short term to the DMA controller. After the transfer of every byte has been done, the DMA controller releases the bus and then again sends a request for the system bus. In this way, the DMA controller takes the clock cycle for transferring every byte.

Transparent Mode

In this case, the DMA controller takes the charge of system bus only if the processor does not require the system bus.

How does the DMA controller work?

The bus is to be shared between the DMA controller and the processor to make the data transfer. The device that holds the bus at a given time is called bus master. When a transfer from the I/O device to the memory or vice versa has to be made, the processor stops the execution of the current program, increments the program counter, moves data over stack then a select signal is sent to DMA controller over the address bus.

If the DMA controller is free, it requests the control of the bus from the processor by raising the bus request signal. The processor grants the bus to the controller by raising the bus grant signal, now the DMA controller is the bus master. The processor initiates the DMA controller by sending the memory addresses, a number of blocks of data to be transferred, and the direction of data transfer. After assigning the data transfer task to the DMA controller, instead of waiting ideally till completion of data transfer, the processor resumes the execution of the program after retrieving instructions from the stack.

The DMA controller has the full control of buses and can interact directly with memory and I/O devices independent of the CPU. The DMA controller makes the data transfer according to the control instructions received by the processor. After completion of data transfer, it disables the bus request signal and CPU disables the bus grant signal thereby moving control of buses to the CPU.

What are the advantages and disadvantages of the DMA controller?


  1. DMA speedups the memory operations by bypassing the involvement of the CPU.
  2. The work overload on the CPU decreases.
  3. There are only a few numbers of clock cycles needed for each transfer.


  1. The cache coherence problem can be seen when DMA is used for data transfer.
  2. Increases the price of the system.