Table of contents
1.
Introduction
2.
What is DMA Controller?
2.1.
DMA Controller Diagram in Computer Architecture
3.
Working of Direct Memory Access
4.
Types of Direct Memory Access
4.1.
1. Single Bus Cycle DMA:
4.2.
2. Block Transfer DMA:
4.3.
3. Demand Transfer DMA:
4.4.
4. Scatter-Gather DMA:
5.
Modes of DMA controller for transferring data
5.1.
Burst Mode
5.2.
Cycle Stealing Mode
5.3.
Transparent Mode
6.
Working of Direct Memory Access Controller
7.
Advantages of DMA Controller
8.
Disadvantages of DMA Controller
9.
Frequently Asked Questions
9.1.
State advantages of DMA controllers?
9.2.
Upon what, the number of input-output devices controlled by Direct Memory Access(DMA) depends?
9.3.
What are the types of operations for which Direct Memory Access(DMA) is useful?
9.4.
What are the alternative methods of data transferring against Direct Memory Access(DMA)?
9.5.
State disadvantages of DMA controllers?
9.6.
Where is the DMA controller used?
10.
Conclusion
Last Updated: Apr 24, 2024
Easy

Direct Memory Access

Author Muskan Gupta
4 upvotes
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

DMA (Direct Memory Access) is a computer system feature that enables direct data transfer between memory and peripheral devices, like hard drives, without CPU intervention.

Direct Memory Access(DMA)

The Direct Memory Access(DMA) controller performs the role of the station master and helps in speeding up the process of transferring data between input-output devices and memory. The Direct Memory Access(DMA) controller tries to decrease the processor's involvement in the entire process. In this blog, we will learn about the concept of Direct Memory Access. So, let's begin!

Recommended Topic, Microinstruction in Computer Architecture

What is DMA Controller?

The hardware device used for this purpose(Direct Memory Access) is known as a DMA controller. This controller is present in input-output devices as part of its interface circuit. It performs the role of the station master and helps speed up the process of transferring data between Input-output devices and memory. And it tries to decrease the processor's involvement in the entire process.

DMA Controller Diagram in Computer Architecture

DMA Controller Diagram in Computer Architecture

Whenever a processor is asked to read or write a data block, that is, to transfer a data block, it instructs the DMA controller by sending the following information:-

1. The first information is that the data should be read or the data should be written in memory. This information is transferred through reading or writing control lines between the processor and DMA controls to control the mental unit.

2. The processor also provides the first address/data block in memory, where the memory block in memory should be read or where the data block should be written in memory. The DMA controller keeps this in the address register. They are also called first-time address registers.

3. The processor also provides the starting address of the data block in memory, where the data in memory should be read or where the data block should be written in memory. The DMA controller keeps this in the address register. They are also called starting-time address registers.

4. The processor also sends the number of words or say word count, how many words to read or write. This information gets stored in a data count or a word count register.

5. Essential is the address of the I / O device that is looking for reading or writing data. This information gets stored in the data register.

Working of Direct Memory Access

Working of Direct Memory Access

The following points describe the working of the Direct Memory Access(DMA) controller as per the given diagram:-

1. Whenever an input-output device wants to transfer some data to the memory or from memory, it sends a DMA Request that can be referred to as DRQ to the DMA controller. The DMA controller accepts this (DMA Request)DRQ and asks the CPU to capture or hold a few clock cycles by requesting a Hold request(HLD).

2. The CPU receives a hold request (HLD) from the DMA controller, releases the bus, and sends the hold acknowledgment (HLDA) to the DMA controller.

3. After obtaining a hold acknowledgment (HLDA), the DMA controller approves the input-output device (DACK) to perform data transfer. The DMA controller takes power from the system bus and transfers data to or from memory.

4. Once the data transfer completes, the DMA raises an interrupt to notify the processor about completing the data transfer function. The processor can control the bus again and begin processing where it left off.

The DMA controller can now be a separate unit assigned to various I / O devices, or it can also be part of the I / O device interface.

Types of Direct Memory Access

1. Single Bus Cycle DMA:

Single bus cycle DMA is the simplest type of DMA transfer where data is transferred between memory and peripheral devices in a single bus cycle without interrupting the CPU. It is suitable for transferring small amounts of data at a time.

2. Block Transfer DMA:

Block transfer DMA involves transferring a block of data between memory and peripherals in one continuous operation. This type of DMA is more efficient for transferring large amounts of data as it reduces the overhead associated with initiating each transfer individually.

3. Demand Transfer DMA:

Demand transfer DMA, also known as cycle stealing DMA, allows the DMA controller to seize control of the system bus from the CPU during idle cycles. It transfers data in smaller chunks, taking advantage of the CPU's idle time, thus minimizing the impact on CPU performance.

4. Scatter-Gather DMA:

Scatter-Gather DMA is a sophisticated type of DMA that enables the transfer of data between non-contiguous memory locations and peripheral devices. It allows for efficient handling of data stored in scattered memory locations by the use of a scatter-gather list, enhancing flexibility and performance in data transfers.

Modes of DMA controller for transferring data

The alternative methods are not effective for large block data transfer. And the DMA controller does this work at a faster rate and effectively for large blocks.

The modes in which the Direct Memory Access(DMA) controller transfers the data are:

Burst Mode

In this mode, when the DMA controller gets the charge of the system bus, then after that, only after completion of the data transfer does it get to release the system bus, and till then, the processor has to wait for those system buses.

Cycle Stealing Mode

When the DMA controller is in this mode, it forces the processor to stop the operation and leave control over the bus for a short time to the DMA controller. After each byte transfer, the DMA controller releases the bus and re-requests the system bus. In this way, the DMA controller steals the clock cycle to transfer all bytes.

Transparent Mode

Here, the DMA controller only takes over the system bus if the processor does not require a system bus. 


You can also read about the memory hierarchy and Data Structure.

Working of Direct Memory Access Controller

The Direct Memory Access (DMA) controller is a specialized hardware component responsible for managing data transfers between peripheral devices and memory without involving the CPU. The following steps outline the typical working of a DMA controller:

  • Initialization: The DMA controller is initialized by the CPU, where the necessary parameters such as source and destination addresses, transfer size, and transfer mode are configured.
  • Arbitration: The DMA controller arbitrates for control of the system bus to initiate data transfer. It may prioritize between multiple DMA requests based on predefined criteria.
  • Addressing: Once control of the bus is obtained, the DMA controller accesses data from the source peripheral device and transfers it directly to the destination memory location, or vice versa, depending on the operation.
  • Transfer: Data transfer occurs without CPU intervention, allowing the CPU to execute other tasks simultaneously. The DMA controller manages the entire transfer process autonomously.
  • Completion: Upon completing the data transfer, the DMA controller may generate an interrupt to notify the CPU of the transfer's completion or other relevant events.

Advantages of DMA Controller

  • Reduced CPU Overhead: DMA transfers offload data movement tasks from the CPU, allowing it to focus on executing other instructions concurrently. This reduces CPU overhead and improves overall system performance.
  • Faster Data Transfer Rates: DMA controllers can achieve higher data transfer rates compared to CPU-managed transfers, as they operate independently of the CPU's processing speed and can access memory and peripherals more efficiently.
  • Efficient Resource Utilization: By allowing concurrent data transfers between peripherals and memory, DMA controllers optimize resource utilization and enhance system throughput.
  • Improved Real-time Processing: DMA transfers can be prioritized to ensure timely processing of time-critical data, making them suitable for real-time applications where latency is crucial.

Disadvantages of DMA Controller

  • Complexity: Implementing DMA functionality requires additional hardware components and software support, increasing system complexity and development effort.
  • Limited Flexibility: DMA controllers may have limitations in terms of supported transfer modes, address ranges, and peripheral compatibility, which can restrict their applicability in certain scenarios.
  • Potential for Bus Contention: DMA transfers may compete with CPU and other DMA transfers for access to the system bus, leading to potential bus contention and performance degradation under heavy load conditions.
  • Debugging Challenges: Troubleshooting DMA-related issues can be challenging due to the asynchronous nature of DMA transfers and the limited visibility into the transfer process compared to CPU-managed operations.

Frequently Asked Questions

State advantages of DMA controllers?

Following are the advantages of DMA controllers:

  • It transfers the data without involving the processor, so the read-write task gets speed up.
  • It decreases the clock cycle needed to write or read a block of data.
  • It reduces the workload of the processor.

Upon what, the number of input-output devices controlled by Direct Memory Access(DMA) depends?

It depends on the number of channels of the Direct Memory Access(DMA).

What are the types of operations for which Direct Memory Access(DMA) is useful?

Direct Memory Access(DMA) is useful for transferring large amounts of data between memory and devices. It helps to eliminate the need for the CPU to be involved in the transfer, allowing it to be completed quickly and perform other functions simultaneously.

What are the alternative methods of data transferring against Direct Memory Access(DMA)?

Programmed I/O and Interrupt driven I/O are the alternative methods of data transferring against Direct Memory Access(DMA).

State disadvantages of DMA controllers?

Following are the disadvantages of DMA controllers:

  • It will take money to build this, since it is a hardware unit.
  • The problem of cache coherence can occur while using it.

Where is the DMA controller used?

DMA controller is used for decreasing the workload of processors. It is used in graphic cards, sound cards, network cards, etc.

Conclusion

In this article, we have extensively discussed the concepts of Direct Memory Access, alternative methods for data transfer, Direct Memory Access(DMA) controller, Modes of DMA controller for transferring data, DMA controller's working, and frequently asked questions.

Also read, Operating System, What Is a Motherboard and MVVM Architecture Android, Components of Operating System

We hope that this blog has helped you enhance your knowledge regarding Direct memory access and if you would like to learn more, check out our articles on input-output-processor, asynchronous data transfer etc. Do upvote our blog to help other ninjas grow. Happy Coding!

Live masterclass