DMA
DMA
04-10-2019 1
Contents
• DMA Definition
• Need
• DMA vs NO DMA
• Working
• Modes
• Numerical
• Advantages/Disadvantages
• References
• Thank you
04-10-2019 2
Direct Memory Access(DMA)
• Direct memory access (DMA) is a feature of computer systems that allows certain hardware
subsystems to access main system memory (random-access memory), independent of the central
processing unit (CPU).
• DMA controller is a control unit, part of I/O device’s interface circuit, which can transfer blocks of
data between I/O devices and main memory with minimal intervention from the processor.
04-10-2019 3
Why do we need DMA?
DMA is a method of transferring data from the computer's RAM to another part of the computer
without processing it using the CPU. While most data that is input or output from your computer is
processed by the CPU, some data does not require processing, or can be processed by another
device .
04-10-2019 4
DMA vs No DMA
04-10-2019 5
How does DMA works?
04-10-2019 6
Data Transfer Techniques in DMA Controller
• Burst Mode:-In this mode DMA handover the buses to CPU only after completion of whole data
transfer. Meanwhile, if the CPU requires the bus it has to stay ideal and wait for data transfer.
• Cycle Stealing Mode:-In this mode, DMA gives control of buses to CPU after transfer of every byte.
It continuously issues a request for bus control, makes the transfer of one byte and returns the
bus. By this CPU doesn’t have to wait for a long time if it needs a bus for higher priority task.
• Block-Transfer Mode/Transparent Mode:-Here, DMA transfers data only when CPU is executing
the instruction which does not require the use of buses.
04-10-2019 7
Burst Mode
• Definition:- It is the DMA data transfer technique in which no. of data words are transferred
continuously until whole data is not transferred.
• Speed:-This is very fast data transfer technique and is used to transfer data for fast speed devices.
• CPU Utilization:-Low CPU Utilization because CPU remains idle until whole data is not transferred.
04-10-2019 8
Cycle Stealing Mode
• Definition:- It is the data transfer technique in which one data word is transferred and then
control is returned to CPU.
• Speed:- It is the slow data transfer technique as data is transferred only when CPU is idle
• CPU Utilization:- High CPU utilization because data is transferred when CPU has no task to
perform.
04-10-2019 9
Transfer Mode/Block-Transfer Mode
• Data are divided into fixed size block may have same bytes of data . When DMA receives an I/O
request from CPU ,it will forward the request to the device controller. The device controller
prepare the block of block of data transfer it for DMA ,block by block .
• All system buses are under the control of DMA while transferring one block data from device
controller to DMA . But when two consecutive block transfer CPU steals the system buses to
perform other task.
04-10-2019 10
Numerical on DMA
04-10-2019 11
Solution:-
Avg. time to transfer = Avg. seek time + Avg. rotational delay + Data transfer time
Avg Seek Time – time taken to move from 1st track to 1sr track : 0ms, 1st to 2nd : 1ms, 2ms,
3ms,….499ms
Avg Seek time =( ∑0+1+2+3+…+499)/500 = 249.5 ms
Avg Rotational Delay – RMP : 600 , 600 rotations in 60 sec
1 Rotation = 60/600 sec = 0.1 sec
So, Avg Rotational Delay = 0.1/2= 50 ms
Data Transfer Time:- In One 1 Rotation we can read data on one track = 100 * 500 = 50,000 Bytes
data is read in one rotation.
For 250 bytes = 0.1 * 250 / 50,000 = 0.5 ms
Therefore Average Time Taken = 249.5+50+0.5 = 300 ms
04-10-2019 12
Q2 . A hard disk with a transfer rate of 10 Mb/sec is constantly transferring data to memory
using DMA . The processor runs at 600MHz & takes 300&900 clock cycles to initiate & compute
DMA transfer respectively. If the size of the transfer is 20 Kb, What is the percentage of processor
time consumed for the transfer operation?
Solution:-
1
Clock cycle time = ∗ 106 [ Frequency = 1/Time]
600
900+300
For DMA initiation and completion = × 106=2 microsec .
600
1 byte =1/107
04-10-2019 13
Advantages/Disadvantages of DMA
Advantages:-
• DMA speedups the memory operations by bypassing the involvement of the CPU.
• The work overload on the CPU decreases.
• For each transfer, only a few numbers of clock cycles are required
Disadvantages:-
• Cache coherence problem can be seen when DMA is used for data transfer.
• Increases the price of the system.
04-10-2019 14
References
04-10-2019 15
Thank You
04-10-2019 16