DMA (Direct Memory Access)

What is DMA and why we need it?

The problem with both interrupt driven and programmed I/O is the "involvement of processor or CPU" when we have to perform I/O operation between main memory and I/O devices.

Thus, both these forms of I/O suffer from two inherent drawbacks:
1. The I/O transfer rate is limited by the speed with which the processor can test
and service a device.
2. The processor is tied up in managing an I/O transfer; a number of instructions
must be executed for each I/O transfer.

When large volumes of data are to be moved, a more efficient technique is required: direct memory access (DMA).


DMA involves an additional module in system bus and it is capable of taking the control of system buses from the processor. For this purpose, the DMA module must use the buses when the processor is not using them or it can ask for access to control buses from the processor.


The DMA module transfers the entire block of data, one word at a time, directly to or from memory, without going through the processor.
When the transfer is complete, the DMA module sends an interrupt signal to the
processor. Thus, the processor is involved only at the beginning and end of the transfer

Let's talk about pins:-

Pins in CPU: or processor-

Interrupt pin:- It is going to tell CPU whether an interrupt has been raised or not.

BR: When a request signal comes from DMA saying that I need to use the bus.

BG: It is said to be set when the CPU accepts the DMA request and told DMA to use the bus.

BG=0 means Bus is not granted to DMA

BG=1 means Bus is granted to DMA.

Common pins:-

RD: When you have to read something from memory , put this pin-up.

WR: when you have to write something from Memory to I/O device.


DMA works in two modes:

1. Burst Mode

2. Cycle stealing mode.

1. Burst mode:

While dealing with high-speed devices like hard disk once DMA got access to bus, it is not going to leave the bus until all operations are completely performed.


2. Cycle stealing mode.

  1. Used to deal with slower devices.
  2. Transparent way of taking the bus when the CPU is using them.
  3. When DMA forces the processor to suspend operation temporarily. This is called cycle stealing mode.