2. Introduction
An important aspect governing the Computer
System performance is the transfer of data
between memory and I/O devices.
The operation involves loading programs or data
files from disk into memory, saving file on disk,
and accessing virtual memory pages on any
secondary storage medium.
3. What is Direct Memory
Access (DMA) ?
When large volumes of data are to be moved, a more
efficient technique is required: Direct Memory Access
(DMA)
Blocks of data are transferred between an external
device and the main memory, without continuous
intervention by the processor.
4. Implementing DMA in a
Computer System
A DMA controller implements direct memory access in
a computer system.
It connects directly to the I/O device at one end and
to the system buses at the other end. It also interacts
with the CPU, both via the system buses and two new
direct connections.
It is sometimes referred to as a channel. In an
alternate configuration, the DMA controller may be
incorporated directly into the I/O device.
5. DMA Controller
DMA controller is part of the I/O interface.
Performs the functions that would normally be
carried out by the processor when access main
memory. For each word transferred, it provides
the memory address and all the bus signals that
control data transfer.
6. DMA Controller
Although DMAC can transfer data without intervention by the
processor, it’s operation must be under the control of a
program executed by the processor.
To initiate the transfer of a block of data, the processor sends
the starting address, the number of words in the block, and
direction of the transfer. Once information is received, the
DMAC proceeds to perform the requested operation. When
the entire block has been transferred, the controller informs
the processor by raising an interrupt signal.
7.
8. How is OS involved
I/O operations are always performed by the OS in response to a
request from an application program.
OS is also responsible for suspending the execution of one
program and starting another.
OS puts the program that requested the transfer in the
Blocked state,
initiates the DMA operation,
starts execution of another program.
When the transfer is complete, the DMA controller informs the
processor by sending an interrupt request.
OS puts suspended program in the Runnable state so that it
can be selected by the scheduler to continue execution.
9. Fig - DMA Block Diagram
Whether a read or write is requested, using the read or write control
line between the processor and the DMA module
The address of the I/O device involved, communicated on the data lines
The starting location in memory to read from or write to, communicated
on the data lines and stored by the DMA module in its address register
The number of words to be read or written, again communicated via the
data lines and stored in the data count register
10. Steps in a DMA operation
• Processor initiates the DMA controller
• Gives device number, memory buffer pointer, …
• Called channel initialization
• Once initialized, it is ready for data transfer
processor DMA controller
Gives
device
number
I/O device number
11. Fig - DMA Configuration
a) All modules share the same system bus. The DMA module, acting as a surrogate processor, uses
programmed I/O to exchange data between memory and an I/O module through the DMA.
b) This means that there is a path between the DMA module and one or more I/O modules that does
not include the system bus.
c) All modules share the same system bus. The DMA module, acting as a surrogate processor, uses
programmed I/O to exchange data between memory and an I/O module through the DMA
12. Summary
Advantages of DMA
Computer system performance is improved by direct
transfer of data between memory and I/O devices,
bypassing the CPU.
CPU is free to perform operations that do not use
system buses.
Disadvantages of DMA
In case of Burst Mode data transfer, the CPU is
rendered inactive for relatively long periods of time.