DMA is Direct memory access, the name indicates who wants to access the memory directly, they are input and output devices. The CPU, peripherals which contains input and output devices and memory, so these are the main components that are present in the system.

The Input-Output devices want to access the memory directly without the involvement of the CPU, which means when input-output devices want to transmit or store the data, it has to intimate to the CPU, and the CPU will transfer and store the data to memory. It’s the normal process without the DMA controller. It requires two cycles to transfer data from input /output to memory. Here the time is wasting and the transfer of data is becoming very slow.

To make the data transfer rate fast we are using DIRECT MEMORY ACCESS. This will directly transfer the data from input/output to memory without the CPU involvement, but CPU is the master but here DMA will help the data to move from input/output to memory without the involvement of CPU. DMA is designed by Intel to send the data at the fastest rate. Here DMA controller became the master whenever CPU gave the permission to DMA controller.

How DMA operations are performed?

Initially the device like peripheral devices wants to send data to memory, so first device will send DMA request which is (DRQ) and to DMA controller, and this DMA controller sends HLQ (hold request) to CPU, and waits for the CPU to send full Acknowledgement signal.  CPU will handover the system bus to DMA by sending the full acknowledgement. DMA will see this whole acknowledgement signal then it becomes the master.

CPU becomes the slave, the CPU is in hold state, DMA will have to manage all the operations over buses, CPU, memory and Input/Output devices. In Input/Output which is programmed,  the processor will scan to see if there is a device is ready for transferring the data, if it gets to know that Input/Output device is finally ready, then this processor will give itself for sending the data between memory and Input/Output. This is a big drawback of Input/Output that is programmed.

The device will give an interrupt to the processor if it is ready for transferring the data this happens in Interrupt driven Input/Output .

The process will finish its execution that is the current instruction and it will save the current state. It will switch to transferring of data that will lead to a delay. Now the processor will not scan to see if peripheral devices are ready or not. It is completely involved in the process of transferring of data. So this is also not an efficient way of transferring the data.

These two data transfer modes are not necessary for sending big amounts of data. The DMA controller will finish the work faster and it is an efficient for big amount of data to be transferred.

So there are three modes which DMA controller uses:

They are:

  1. Burst mode
  2. Cycle stealing mode
  3. Transparent mode

In burst mode, the DMA controller will get the system bus charge, after that transferring completion, it will release system bus. The CPU has to wait till that process finishes.

In cycle stealing mode, the CPU gets forced by DMA controller which will stop the operation and with draw the control from bus for a short period of time to DMA controller, the DMA will release the bus  and will request the system bus, like this, DMA will use the cycle clock for sending data bytes.

In transparent mode, the DMA controller will use system bus when the processor do not need system bus.

Now lets know about DMA controller diagram,

If there is a request for a processor for reading or writing data,by sending the information it will instruct DMA controller ,

  1. The info is to know if the data should be read from the memory or the data should write into the memory. The information gets passed through read and write control lines, which is in between DMA controller and processor which is called control logic unit.
  2. Starting address of the data block which is in the memory is provided by the processor, if the data block which is present in memory has to read or write into the memory,  Address register will be stored by DMA controller, this is also known as “starting address register”.
  3. Word count is sent by processor, like it says how many words are to be read and written. The information is stored in “data count” or the “word count register”.
  4. Address of Input/Output device is very much important, which wants to read or write the data. Data register will store the information.

Advantages and disadvantages of Direct memory access:

Advantages:

  1. Without processor involvement , data transferring will speed up the read and write operations.
  2. The clock cycle will get reduced by DMA controller, for reading and writing operations.
  3. Over head can also be reduced by using DMA controller for the processor.

Disadvantages:

  1. There is much cost for implementing DMA controller because it is a hardware unit.
  2. By using DMA controller, coherence of cache problem will occur

Input/Output interface(Interrupt and DMA mode)

This method is useful for sending the information between the “internal storage and external Input/Output devices” which is known as Input/Output interface.

There are special communication links from the peripheral devices they are interfaced by CPU, that are connected to the computer. The problems are resolved by using these communication links.

For supervising and synchronizing all input and output special hardware components are existed between CPU and peripheral, these are known as interface units.

Peripherals data transfer will be done by using three ways:

  1. Programmed Input/Output
  2. Interrupt- initiated Input/Output
  3. DMA

Programmed I/O means it will occur because of instructions of Input/Output which are written inside the program. The instruction is initiated for every data instruction in the program. The transfer happen from memory to CPU register. Continuous monitoring is needed by the CPU.

In Interrupt- initialized I/O: in the above situation, the CPU was very busy without any use. This situation can be overcome by using a driven method for interrupt for transferring the data. Interrupts and special commands are used which are necessary to inform the interface which will give an interrupt request signal if data is there from a device.

In the meanwhile, the CPU will look after any other program running on the system. And this interface is used for device monitoring. If the device is ready for transferring h=the data, it will start an interrupt request signal for the computer. When external interrupt signal is detected the CPU will stop the work its doing and it will give a process to the service program for I/O transfer, and then give it back to the work it was actually performing.

The two methods Programmed I/O and interrupt-driven I/O needs process to be active for transferring the data between the I/O and memory, so these both will suffer from drawbacks.

The I/O transferring capacity has a limited speed, and the processor will give a service and also test it.

The processor is useful for managing the I/O transfer, many instructions should be executed for every Input/Output transfer.

I hope you have read the article on “Direct Memory Access Controller” and understood properly.