Elecia White Explains Direct Memory Access — Via Sword-and-Sorcery Maps and Dry Cleaning Assistants

If you're looking to get to grips with how DMA works, in an architecture-agnostic way, White's metaphors are a great place to start.

ghalfacree
about 2 months ago HW101

Embedded software developer Elecia White has penned an architecture-agnostic guide to the inner workings of Direct Memory Access (DMA) — with a little leaning on an adventurous metaphor.

"I have two metaphors for how DMA works. The first one is terrible but fun. The second is also terrible but also fun. Hopefully between the two, the reasoning and the concept make sense," White explains. "I’m not going to tell you how to get DMA working on your system, I don't know your processor. Instead, my goal is to give you some insights into how DMA works and why we use it to make our systems faster."

Direct Memory Access (DMA) is a common feature of modern computing systems, and is designed to offload the task of accessing data in memory from the CPU — freeing its resources for doing actual work. To get the best out of DMA, though, you have to understand it — which is where White's metaphors come in.

If you're looking to get a handle on DMA, a diversion into Dungeons & Dragons-style map-making and dry cleaning may help. (📷: Elicia White)

The first is a Dungeons & Dragons-esque adventure map, in which a central CPU castle links to places dubbed "Display Town," "Analog to Digital Conversion Fields," "Port Output," the "Algorithmic Forges," and even "Memory Lake." Journeying to or from the CPU and its nearby "Memory Lake" to any of the outlying regions requires a long like on unfeasibly large bridges over mountains — journeys that, White says, could be made easier and faster by boring tunnels through the mountains. "In this metaphor, those tunnels are DMA, direct memory access."

The next metaphor, which is perhaps somewhat less exciting than the swords-and-sorcery theme of the first, is closer to home: dry cleaning, and delegating "micro-assistants" to collect it for you. "I don’t know how to build a tunnel," White admits, "but I do know how to delegate. Sometimes DMA is harder than doing it yourself. Other times, it is a luxury to have someone else doing your chores for you."

To see how these metaphors are resolved into how DMA actually works in the real world, using the example of an analog to digital converter communicating over an SPI bus with or without DMA, see White's post on Embedded.fm.

ghalfacree

Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.

Latest Articles