Open In App

Direct Memory Access (DMA) Controller in Computer Architecture

Last Updated : 18 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In modern computer systems, transferring data between input/output devices and memory can be a slow process if the CPU is required to manage every step. To address this, a Direct Memory Access (DMA) Controller is utilized.

A Direct Memory Access (DMA) Controller solves this by allowing I/O devices to transfer data directly to memory, reducing CPU involvement. This increases system efficiency and speeds up data transfers, freeing the CPU to focus on other tasks. DMA controller needs the same old circuits of an interface to communicate with the CPU and Input/Output devices. 

DMA Controller

Direct Memory Access (DMA) uses hardware for accessing the memory. This hardware is called a DMA Controller. It has the work of transferring the data between input, output devices and main memory with very less interaction with the processor. The Direct Memory Access Controller is a control unit, which has the work of transferring data.

DMA Controller in Computer Architecture

DMA Controller is a type of control unit that works as an interface for the data bus and the I/O Devices. As mentioned, DMA Controller has the work of transferring the data without the intervention of the processors, processors can control the data transfer. DMA Controller also contains an address unit, which generates the address and selects an I/O device for the transfer of data. Below is the block diagram of the DMA Controller.

DMA_

Block Diagram of DMA Controller

Types of Direct Memory Access (DMA)

There are four popular types of DMA.

  • Single-Ended DMA: In this type, the DMA controller is connected only to one device (usually either the memory or the I/O device), and it directly controls data transfer.
  • Dual-Ended DMA: The DMA controller is connected to both the source and the destination, typically memory and an I/O device.
  • Arbitrated-Ended DMA: In systems with multiple DMA devices or masters, arbitration is needed to decide which device gets control of the bus. It is more advanced than Dual-Ended DMA.
  • Interleaved DMA: Interleaved DMA are those DMA that read from one memory address and write from another memory address.

Working of DMA Controller

The DMA controller registers have three registers as follows.

  • Address register: It contains the address to specify the desired location in memory.
  • Word count register: It contains the number of words to be transferred.
  • Control register: It specifies the transfer mode.

All registers in the DMA appear to the CPU as I/O interface registers. Therefore, the CPU can both read and write into the DMA registers under program control via the data bus.

The figure below shows the block diagram of the DMA controller. The unit communicates with the CPU through the data bus and control lines. Through the use of the address bus and allowing the DMA and RS register to select inputs, the register within the DMA is chosen by the CPU.

RD and WR are two-way inputs. When BG (bus grant) input is 0, the CPU can communicate with DMA registers. When BG (bus grant) input is 1, the CPU has relinquished the buses and DMA can communicate directly with the memory.

Working Diagram of DMA Controller

Working Diagram of DMA Controller

The CPU initializes the DMA by sending the given information through the data bus.

  • The starting address of the memory block where the data is available (to read) or where data are to be stored (to write).
  • It also sends word count which is the number of words in the memory block to be read or written.
  • Control to define the mode of transfer such as read or write.
  • A control to begin the DMA transfer

Modes of Data Transfer in DMA

There are 3 modes of data transfer in DMA that are described below.

Burst Mode

  • In Burst Mode, the DMA controller takes full control of the system bus and transfers the entire block of data in one go.
  • The bus is not handed back to the CPU until the entire data transfer is complete.
  • This mode is efficient for large data transfers but can delay CPU operations.

Transparent Mode

  • In Transparent Mode, the DMA controller transfers data only when the CPU is not using the system bus.
  • It effectively sneaks in transfers during idle CPU cycles, ensuring the CPU is never interrupted.
  • Best when CPU performance is critical and some delay in data transfer is acceptable.

Cycle Stealing Mode

  • In Cycle Stealing Mode, the DMA controller transfers one byte (or word) at a time and then releases control of the bus back to the CPU.
  • This mode generates frequent bus requests but allows the CPU to execute instructions in between DMA transfers.
  • Useful when the DMA task is important but should not entirely block the CPU, such as in audio or video streaming.

Advantages of DMA Controller

  • DMA speeds up memory operations and data transfers by allowing peripherals to communicate directly with memory, bypassing the CPU.
  • During data transfer, the CPU is not involved, which significantly reduces its workload.
  • Operates efficiently, requiring very few clock cycles to complete data transfers.
  • It distributes workload very appropriately.
  • By offloading data movement tasks from the CPU, DMA distributes the overall system workload more effectively

Disadvantages of DMA Controller

  • Costly operation due to the need for additional hardware and control logic.
  • Suffers from Cache-Coherence Problems.
  • It increases the overall cost of the system.
  • It increases the complexity of the software.


Next Article

Similar Reads