LearnViz CompSci
Home / Learn / Computer Architecture & Logic / DMA

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

  1. The CPU programs the DMA controller with source, destination and length.
  2. The DMA controller reads from the device.
  3. It writes the data straight to memory.
  4. The CPU is free to run other code meanwhile.
  5. 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

How to study this topic

  1. Read the explanation above and restate the definition in your own words.
  2. Open the interactive lesson and answer its mini quiz.
  3. Read the common pitfall, then write a short example that avoids it.
  4. Check your understanding in the Computer Architecture & Logic quiz, and revisit the topic if you miss a question.

Frequently asked questions

What is DMA?
Hardware letting devices move data without CPU involvement. It belongs to Computer Architecture & Logic and is an advanced-level topic.
Where do people use DMA?
Disk and SSD controllers, network cards, sound and graphics hardware, camera interfaces and memory-to-memory copies in embedded systems use DMA.
What is the most common mistake with DMA?
DMA bypasses the CPU caches unless hardware keeps them coherent, so software may need to flush or invalidate caches around transfers.
What should I learn before this topic?
Start with GPU Architecture, the topic just before it in Computer Architecture & Logic.
How can I practice it?
Answer the mini quiz in the interactive lesson, then take the Computer Architecture & Logic quiz.
Is DMA hard to learn?
It is an Advanced topic. Expect to read the explanation more than once and to connect it with earlier topics. Working through a small example by hand helps most.
How long does it take to learn DMA?
Most learners can read the explanation and finish the interactive lesson in under an hour. Fluency comes from applying the idea, so plan a few short practice sessions with the quiz.
Which topics are related to DMA?
GPU Architecture, Interrupts, SIMD and Vector Processing are closely connected. The full list is in the related topics section of this page.
What should I study after DMA?
Continue with Interrupts, the next topic in Computer Architecture & Logic.

Related topics