DMA
DMA
1. **CPU Initiates the Transfer**: The CPU initiates the DMA transfer by
informing the DMA controller (DMAC) about the source, destination
addresses, and the size of the data to be transferred.
2. **DMA Controller Takes Over**: Once the transfer is set up, the DMA
controller takes over the responsibility of handling the data transfer,
freeing the CPU to perform other tasks.
3. **Data Transfer**: The DMAC then handles the data transfer directly
between the I/O device and the memory. It uses the system’s data bus
to transfer data.
```
+----------------+ +-------------------+
| CPU | | Memory |
+-------^--------+ +-------------------+
| ^
V |
+----------------+ +-------+--------+
| | | (e.g., HDD) |
+----------------+ +----------------+
```
- The **CPU** only sets up the transfer and the **DMA Controller** handles
the bulk of the data movement between **I/O Devices** (such as hard drives
or network cards) and the **Memory**.
- Once the transfer is complete, the DMA controller sends an interrupt signal
to the CPU, informing it that the data transfer is done.
1. **Burst Mode**: The DMA controller transfers a block of data all at once
and then relinquishes control of the system bus.
2. **Cycle Stealing**: The DMA controller takes control of the bus for each
data transfer cycle, temporarily pausing the CPU.
3. **Transparent Mode**: The DMA controller transfers data only when the
CPU is not using the system bus, effectively making the DMA transfer
“invisible” to the CPU.
In conclusion, DMA offloads data transfer tasks from the CPU to the DMA
controller, improving system efficiency during data transfers. The memory
management system plays a crucial role in handling memory allocation,
protection, and optimization for efficient program execution.