Input/Output (I/O) Transfers and DMA-Based Data Movement
Input/Output I/O transfer methods describe how the CPU and I/O devices coordinate to move data across the system interconnect (buses) and memory. Common categories include Programmed I/O (CPU-driven polling), Interrupt-driven I/O, and Direct Memory Access (DMA) (device/controller transfers directly to/from memory).3
DMA is designed to reduce CPU overhead and increase throughput by allowing a DMA controller (or DMA engine) to act as a bus master, transferring blocks while the CPU executes other work.2
Key learning terms in this section:
- Programmed I/O
- Interrupt-driven I/O
- Direct Memory Access (DMA)
- Bus master
- Memory-mapped I/O
Footnotes
-
I/O programming and types of I/O transfers (programmed I/O, interrupts) - Overview of categories of I/O and transfer mechanisms. ↩
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩ ↩2
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩ ↩2
DMA (Direct Memory Access) explained
Types of I/O transfers (CPU-driven vs hardware offload)
1) Programmed I/O (polling / CPU-driven transfers)
In Programmed I/O, the CPU explicitly initiates each transfer (e.g., reading a status register, then reading/writing data). Typically, the CPU polls a device “ready” bit or status register and then moves each data word/byte by executing I/O instructions.2
Characteristics
- CPU is actively involved in every data movement step.
- Simple to implement, but wastes CPU cycles while polling.
- Latency may be lower than interrupt-based approaches in some cases, but overall CPU utilization is usually poor.
2) Interrupt-driven I/O (event notification)
In Interrupt-driven I/O, the device notifies the CPU when it is ready (e.g., when input data arrives or output buffer space becomes available). The CPU generally:
- programs the device,
- goes on with other work (or waits),
- services an interrupt routine when signaled.2
Characteristics
- Reduces busy-waiting: CPU work is event-based.
- Interrupt overhead exists (context switches, interrupt service time).
- Throughput is often limited compared with DMA for high data rates because the CPU still may perform the actual data copying.
3) DMA (direct memory transfers under bus control)
In Direct Memory Access (DMA), the CPU configures a [DMA controller]{def="Dedicated hardware that performs memory transfers under bus control} with:
- source/destination (device ↔ memory),
- transfer length,
- transfer mode (e.g., block, burst),
- (optionally) interrupt-on-completion.
Then DMA performs transfers by driving bus transactions while the CPU is free.2
Characteristics
- CPU involvement is mostly reduced to setup and completion handling.
- Much better for high-throughput streams (networking, disk, audio/video pipelines).
- Requires bus arbitration and careful coordination with cache/memory coherency mechanisms in many systems.2
Footnotes
-
I/O programming and types of I/O transfers (programmed I/O, interrupts) - Overview of categories of I/O and transfer mechanisms. ↩ ↩2
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩ ↩2 ↩3 ↩4
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩ ↩2
Conceptual comparison of I/O transfer approaches
Qualitative trends (not measured values).
Visualizing where the CPU participates
The following diagram highlights data movement responsibility:
How DMA data transfer takes place through bus control
- 1Step 1
CPU programs the DMA engine: transfer direction (device→memory or memory→device), starting address, transfer length, and mode. Often it also enables an interrupt when the transfer completes. 2
Footnotes
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩
-
- 2Step 2
The DMA engine issues a bus request and waits for permission to act as a bus master using bus arbitration (so it doesn’t collide with CPU or other masters). 2
Footnotes
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩
-
- 3Step 3
Once granted, the DMA engine begins issuing memory read/write transactions (and may perform programmed I/O to the device interface for handshaking depending on the platform). 2
Footnotes
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩
-
- 4Step 4
DMA moves data in one of several patterns: single transfers per request, or burst/block transfers using counters and internal address registers. Each iteration updates internal pointers until the programmed length completes. 2
Footnotes
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩
-
- 5Step 5
DMA cooperates with device readiness via DMA requests/acknowledges or buffer-ready signals, ensuring the device has data (for reads) or space (for writes). 2
Footnotes
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩
-
- 6Step 6
After the final word/byte, the DMA engine deasserts/finishes the transfer, optionally raises an interrupt to the CPU, and may update bookkeeping registers. 2
Footnotes
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩
-
DMA internals: registers and state (conceptual)
DMA engines typically maintain:
- a current address
- a remaining count
- a transfer mode
- control bits for direction and interrupt-on-completion
During transfer, the engine repeatedly:
- performs a bus transaction (read or write),
- exchanges data with the device interface,
- increments/decrements internal pointers,
- checks the count to determine completion.2
Footnotes
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩
Why DMA is faster than CPU polling
Polling wastes CPU cycles; DMA offloads copying and allows the bus and memory system to move data efficiently in bursts/blocks while the CPU does useful work. This is the core motivation behind DMA-based I/O. 2
Footnotes
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩
DMA and cache/memory coherency pitfalls
On systems with caches, DMA writes may bypass CPU caches unless the platform uses coherent DMA, cache flushing/invalidation, or explicit synchronization. Incorrect handling can lead to stale or inconsistent data being observed by software. 2
Footnotes
-
Direct memory access (DMA) - Conceptual description of DMA and how it reduces CPU involvement. ↩
-
DMA controller / DMA operation fundamentals - Explains DMA controller roles (transfer parameters, operation cycle concepts). ↩
Where DMA fits in a real system
DMA is most valuable when:
- transfers are large (e.g., disk blocks, video frames),
- rates are high (e.g., network payloads),
- CPU must remain responsive (real-time or multitasking workloads).
However, even with DMA, the CPU is not completely absent:
- CPU configures descriptors/registers.
- CPU handles completion/interrupts.
- System software ensures coherency, alignment constraints, and error handling.
Common distinctions and edge cases
Lifecycle of an I/O data transfer (DMA-centric view)
CPU configures DMA
1) SetupProgram direction, start address, and length; optionally enable completion interrupt."
DMA requests bus access
2) ArbitrationDMA engine waits for bus master grant to avoid conflicts."
Hardware moves data
3) TransferDMA issues read/write transactions and performs device handshaking."
Completion & software notification
4) FinalizationDMA stops after count reaches zero; raises interrupt or signals completion."
DMA and I/O transfer flashcards
Knowledge Check
Which statement best describes Direct Memory Access (DMA)?