Warning: mkdir() [
function.mkdir]: Permission denied in
/home/webs/affiliatelib2/CacheManager.php on line
12
Warning: mkdir() [
function.mkdir]: No such file or directory in
/home/webs/affiliatelib2/CacheManager.php on line
12
Warning: fopen(/home/templatecore2cache//*cluesnet.com/d0/d04e72b51d12fe8fcb2b4ad4e188c6a9a73ebac7.tc2cache) [
function.fopen]: failed to open stream: No such file or directory in
/home/webs/affiliatelib2/CacheManager.php on line
130
Warning: fwrite(): supplied argument is not a valid stream resource in
/home/webs/affiliatelib2/CacheManager.php on line
131
Warning: fclose(): supplied argument is not a valid stream resource in
/home/webs/affiliatelib2/CacheManager.php on line
132
Direct memory access (
DMA) is a feature of modern computers that allows certain hardware subsystems within the computer to access system Computer storage for reading and/or writing independently of the central processing unit. Many hardware systems use DMA including
disk drive controllers, graphics cards, network cards, and sound cards. Computers that have DMA channels can transfer data to and from devices with much less
central processing unit overhead than computers without a DMA channel.
Without DMA, using programmed input/output (PIO) mode, the CPU typically has to be occupied for the entire time it's performing a transfer. With DMA, the CPU would initiate the transfer, do other operations while the transfer is in progress, and receive an interrupt from the DMA controller once the operation has been done. This is especially useful in real-time computing applications where not stalling behind concurrent operations is critical.
Principle
DMA is an essential feature of all modern computers, as it allows devices to transfer data without subjecting the CPU to a heavy overhead. Otherwise, the CPU would have to copy each piece of data from the source to the destination. This is typically slower than copying normal blocks of memory since access to I/O devices over a peripheral bus is generally slower than normal system RAM. During this time the CPU would be unavailable for any other tasks involving CPU bus access, although it could continue doing any work which did not require bus access.
A DMA transfer essentially copies a block of memory from one device to another. While the CPU initiates the transfer, it does not execute it. For so-called "third party" DMA, as is normally used with the
Industry Standard Architecture bus, the transfer is performed by a DMA controller which is typically part of the motherboard chipset. More advanced bus designs such as
peripheral component interconnect typically use bus mastering DMA, where the device takes control of the bus and performs the transfer itself.
A typical usage of DMA is copying a block of memory from system RAM to or from a buffer on the device. Such an operation does not stall the processor, which as a result can be scheduled to perform other tasks. DMA transfers are essential to high performance embedded systems. It is also essential in providing so-called zero-copy implementations of peripheral
device drivers as well as functionalities such as network packet routing,
audio playback and
streaming video.
Cache coherency problem
DMA can lead to cache coherency problems. Imagine a CPU equipped with a cache and an external memory, which can be accessed directly by devices using DMA. When the CPU accesses location X in the memory, the current value will be stored in the cache. Subsequent operations on X will update the cached copy of X, but not the external memory version of X. If the cache is not flushed to the memory before the next time a device tries to access X, the device will receive a stale value of X.
Similarly, if the cached copy of X is not invalidated when a device writes a new value to the memory, then the CPU will operate on a stale value of X.
DMA engines
In addition to hardware interaction, DMA can also be used to offload expensive memory operations, such as large copies or scatter-gather operations, from the CPU to a dedicated DMA engine. While normal memory copies are typically too small to be worthwhile to offload on today's desktop computers, they are frequently offloaded on
embedded devices due to more limited resources.
Newer Intel Xeon processors also include a DMA engine technology called I/OAT, meant to improve network performance on high-throughput network interfaces, in particular
gigabit Ethernet and faster. However, various benchmarks with this approach by Intel's
Linux kernel developer Andrew Grover indicate no more than 10% improvement in CPU utilization with receiving workloads, and no improvement when transmitting data.
Reconfigurable computing DMA circuits, for instance, based on GAG
Generic Address Generators, provide the enabling technology of
Auto-sequencing memory, programmable by Flowware to generate the data streams for running system architectures based on the Anti machine paradigm, which could be called a DMA engine.
Examples
ISA
For example, a Personal computer Industry Standard Architecture DMA controller has 16 DMA channels of which 7 are available for use by the PC's CPU. Each DMA channel has associated with it a 16-bit address register and a 16-bit count register. To initiate a data transfer the device driver sets up the DMA channel's address and count registers together with the direction of the data transfer, read or write. It then instructs the DMA hardware to begin the transfer. When the transfer is complete, the device interrupts the CPU.
"
Scatter-gather_DMA" DMA allows the transfer of data to and from multiple memory areas in a single DMA transaction. It is equivalent to the chaining together of multiple simple DMA requests. Again, the motivation is to off-load multiple
input/output interrupt and data copy tasks from the CPU.
DRQ stands for DMA request; DACK for DMA acknowledge. These symbols are generally seen on hardware
schematics of computer systems with DMA functionality. They represent electronic signaling lines between the CPU and DMA controller.
PCI
As mentioned above, a
Peripheral Component Interconnect architecture has no central DMA controller, unlike ISA. Instead, any PCI component can request control of the bus ("become the bus master") and request to read and write from the system memory. More precisely, a PCI component requests bus ownership from the PCI bus controller (usually the
Southbridge (computing) in a modern PC design), which will arbitrate if several devices request bus ownership simultaneously, since there can only be one bus master at one time. When the component is granted ownership, it will issue normal read and write commands on the PCI bus, which will be claimed by the bus controller and forwarded to the memory controller using a scheme which is specific to every chipset.
As an example, on a modern
AMD Socket AM2-based PC, the southbridge will forward the transactions to the Northbridge (computing) (which is integrated on the CPU die) using HyperTransport, which will in turn convert them to DDR2 operations and send them out on the DDR2 memory bus. As can be seen, there are quite a number of steps involved in a PCI DMA transfer; however, since the components outside the PCI bus are faster than the PCI bus itself by almost an order of magnitude or more (see List of device bandwidths), that poses little problem.
AHB
In System-on-Chips and
Embedded Systems, typical system bus infrastructure is complex on-chip bus such as AMBA AHB. AMBA defines two kinds of AHB component: master and slave. Slave interface is similar to Programmed I/O through which the software (running on embedded CPU, e.g.
ARM) can write/read I/O registers or (less commonly) local memory block inside the device. Master interface can be used by the device to perform DMA transaction to/from system memory without heavily loading the CPU.
Therefore high bandwidth device/hardware such as network controller that need to transfer huge amount of data to/from system memory will have two interface adapters to the AHB bus: master and slave interface. This is because on-chip bus like AHB does not support tri-stating the bus or alternating the direction of any line on the bus. Like PCI, no central DMA controller is required since the DMA is bus-mastering, but an arbiter is required in case of multiple masters present on the system.
Internally, a multichannel DMA engine is usually present in the device to perform multiple concurrent scatter/gather operations as programmed by the software.
See also
References
- mmap() and DMA, from Linux Device Drivers, 2nd Edition, Alessandro Rubini & Jonathan Corbet
- Memory Mapping and DMA, from Linux Device Drivers, 3rd Edition, Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman
- DMA and Interrupt Handling
- DMA Modes & Bus Mastering
Direct memory access - Wikipedia, the free encyclopedia
Direct memory access (DMA) is a feature of modern computers and microprocessors that allows certain hardware subsystems within the computer to access system memory for reading and ...
Direct Memory Access from FOLDOC
Direct Memory Access < architecture > (DMA) A facility of some architectures which allows a peripheral to read and write memory without intervention by the CPU.
Direct Memory Access (DMA)
No Description metadata ... Direct Memory Access (DMA) If we look at the computer system diagram we can see that when transferring data from a device such as a hard disk the CPU is ...
Dictionary of Computers - direct memory access
Skip to page content | Tiscali Quicklinks. Please visit our Accessibility Page for a list of the Access Keys you can use to find your way around the site, skip directly to the main ...
Remote Direct Memory Access - Wikipedia, the free encyclopedia
Remote Direct Memory Access (RDMA) allows data to move directly from the memory of one computer into that of another without involving either one's operating system.
Direct memory access (DMA) - Windows Vista Help
Technology that enables certain devices, such as hard disks and CD or DVD drives, to transfer information directly to and from the computer's memory without using the computer's ...
direct memory access - Hutchinson encyclopedia article about direct ...
In computing, a technique used for transferring data to and from external devices without going through the central processing unit (CPU) and thus speeding up transfer rates.
Direct memory access - a reference guide from Electronicstalk
Looking for the latest direct memory access-related news? Find it here on the Electronicstalk website with Laurence Marchini, Editor
Direct memory access controller (EP0328450B1)
Abstract: [From equivalent EP0328450A2] A direct memory access controller coupled to a system bus (38, 39) for controlling a data transfer by a direct memory access ...
Remote Direct Memory Access
Network Working Group A. Romanow. Request for Comments: 4297 Cisco