Direct Memory Access
(DMA) is the name for the method by which devices (disk drives, ULI
, etc.) are able to write directly into memory without having to send everything through the CPU
, instead running it through a specialized processor called a DMA controller
To initiate a DMA transfer, the host writes a DMA command block into memory containing a pointer to the sources of the transfer, and a count of the number of bytes to be transferred. The only time the CPU gets involved in the DMA process is when it writes the address of this command to the block. From here on, DMA is run by the DMA controller until the transfer is complete.
Handshaking occurs between the DMA controller and the device controller via DMA-request and DMA-acknowledge wires. When the device has a word of data available for transfer, it sends a DMA-request message, causing the DMA controller to seize the memory bus, routing it to the desired memory address, and send the device a DMA-acknowledge message, at which point the device sends the data. This process continues until the transfer of data is complete (the byte counter kept in the control block reaches 0). At this point, the DMA controller interrupts the CPU to inform it that the transfer is complete.
Although the CPU interrupt briefly prevents the CPU from performing other actions, and seizing the memory bus prevents the CPU from accessing main memory for the duration of the seizure (though it can still use primary and secondary memory, i.e. L1 and L2 caches), the use of DMA increases overall system performance, and thus is considered to be a "Good Thing."