DMA (direct Memory access), directly memory access, is a mechanism for fast data transfer. Data transfer can be from adapter card to memory, from memory to adapter card or from memory to another memory.
It does not require CPU involvement when it is used for data transfer. Each computer host board has a DMA controller, which is usually programmed by the computer and stored using a ROM on an adapter, such as a ROM on a floppy drive controller, which controls DMA transfer data. Once the controller is initialized and the data is transferred, DMA can be separated from the CPU to complete the data transfer independently.
Within a short period of time when the DMA transfer started, there were basically two processors working for it, one for executing code, one for transmitting data. Another benefit of using DMA for data transfer is that data is transmitted directly between the source address and destination address, without intermediate media. If a byte is transferred from the adapter card to memory through the CPU, two steps are required. First, the CPU reads this byte from the adapter card into the internal register and then transfers it from the Register to the appropriate address in memory. The DMA controller simplifies these operations into one step, manipulating the control signal on the bus to make the writing section complete at once. This greatly improves the speed and efficiency of computer operation.
Computer development Today, DMA is no longer used for memory to memory data transfer, because the CPU speed is very fast, do this, than with DMA control, but to transfer data between adapter card and memory, still is not DMA. To transfer data from an adapter card to memory, DMA also triggers a bus that reads the data bus from the adapter card (that is, I/O Read) and writes to memory. Activating I/O read is to allow the adapter to place a data unit (usually a byte or a word) on the PC bus, because the memory write bus is also activated and the data is copied from the PC bus to the memory at the same time.
Direct Memory Access (DMA) is a way of working entirely with the hardware to perform I/O exchange. The DMA controller completely takes over the control of the bus from the CPU. Data exchange does not go through the CPU, but directly between memory and I/O devices. The DMA controller takes the following three ways:
① Stop CPU access memory: When the peripheral requires the transmission of a batch of data, the DMA controller sends a signal to the CPU. After the DMA controller obtains the bus control, the data transfer begins. After the transfer of a batch of data, the DMA controller notifies the CPU that it can use memory and returns the control of the bus to the CPU.
② Cycle misappropriation: When the I/O device does not have a DMA request, the CPU accesses the memory according to the program: once the I/O device has a DMA request, the I/O device diverts one or several cycles.
③DMA and CPU Alternate visit: A CPU cycle can be divided into 2 cycles, one for the DMA controller visit, another dedicated CPU visit. Does not require the use of bus access to the application, establishment and return process.