Advanced Topic 41 of 51 Computer Architecture & Logic
DMA
Hardware letting devices move data without CPU involvement.
How it works
Direct memory access lets a peripheral device or a dedicated controller transfer blocks of data to or from main memory without the CPU copying each word. The CPU programs the controller with source, destination and length, and the controller takes the bus, moves the data and raises an interrupt when finished. This frees the processor for other work during large transfers.
Step-by-step walkthrough
- The CPU programs the DMA controller with source, destination and length.
- The DMA controller reads from the device.
- It writes the data straight to memory.
- The CPU is free to run other code meanwhile.
- The controller raises an interrupt when the transfer is complete.
Where it is used
Disk and SSD controllers, network cards, sound and graphics hardware, camera interfaces and memory-to-memory copies in embedded systems use DMA. High-speed I/O would be impossible if the CPU copied every byte.
Common pitfall
DMA bypasses the CPU caches unless hardware keeps them coherent, so software may need to flush or invalidate caches around transfers. Buffers must be physically contiguous or described by scatter-gather lists and kept pinned. Bus contention can slow the CPU, and a malicious device with DMA access can read memory unless an IOMMU limits it.
Where it fits in the course
DMA is topic 41 of 51 in Computer Architecture & Logic, rated Advanced. It follows GPU Architecture. The next topic is Interrupts.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Computer Architecture & Logic quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Computer Architecture & Logic quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is DMA?
Where do people use DMA?
What is the most common mistake with DMA?
What should I learn before this topic?
How can I practice it?
Is DMA hard to learn?
How long does it take to learn DMA?
Which topics are related to DMA?
What should I study after DMA?
Related topics
- GPU Architecture (Computer Architecture & Logic)
- Interrupts (Computer Architecture & Logic)
- SIMD and Vector Processing (Computer Architecture & Logic)
- Bus Architecture (Computer Architecture & Logic)