In normal I/O, the CPU must transfer each byte/word between device and memory. For large transfers (disk reads, network packets), this wastes CPU cycles on simple copy operations.
DMA allows I/O devices to transfer data directly to/from memory without CPU intervention, freeing the CPU for other tasks during data transfer.
- CPU programs the DMA controller: memory address, transfer size, direction (read/write)
- DMA controller takes control of the system bus
- Device transfers data directly to/from memory via DMA
- DMA controller increments address and decrements count for each transfer
- When transfer completes, DMA raises an interrupt to notify CPU
- Transfers data at memory bus speeds (very fast)
- CPU is free during transfer (can run other processes)
- Requires DMA controller hardware (additional cost)
- Best for high-speed, large block transfers
- Built from: O System, System Bus, Device Controller
- Builds into: O Request to Hardware Operation
- Related: Polling, Interrupt Handler
- Contrasts with: O Software (CPU still involved in non-DMA I/O)
- DMA and CPU both need system bus — bus arbitration required
- Wrong DMA setup (bad address/size) can corrupt memory
- Some systems have limited DMA channels (resource contention)
- Cache coherency issues — CPU cache may not see DMA-written data