I/O Program Controlled Transfer vs DMA Transfer
In this article, we will discuss the overview of Modes of transfer and mainly our focus will be on the difference between I/O Program Controlled Transfer vs DMA Transfer. Let’s discuss it one by one.
Prerequisite – Modes of Transfer in detail
Modes of Transfer
The CPU executes the I/O instructions & accepts the data temporarily but finally, the source/ destination will be any memory unit. There are various modes in which data transfer could take place between CPU & I/O devices. Data transfer to & from peripherals can be handled in one of the 3 given modes as follows.
- Programmed I/O
- Interrupt — Driven I/O
- Direct Memory Access (DMA)
Let’s discuss them one by one.
- Programmed I/O:
In program-controlled I/O, the processor program controls the complete data transfer. So only when an I/O transfer instruction is executed, the transfer could take place. It is required to check that device is ready/not for the data transfer in most cases. Usually, the transfer is to & from a CPU register & peripheral. Here, CPU constantly monitors the peripheral. Here, until the I/O unit indicates that it is ready for transfer, the CPU wait & stays in a loop. It is time-consuming as it keeps the CPU busy needlessly.
- Interrupt—Driven I/O:
To overcome the disadvantage of Programmed I/O,i.e., keeping CPU busy needlessly, Interrupt — Driven I/O is used. In this approach, when a peripheral sends an interrupt signal to the CPU whenever it is ready to transfer data. This indicates that the I/O data transfer is initiated by the external I/O device. The processor stops the execution of the current program & transfers the control to interrupt the service routine when interrupted. The interrupt service routine then performs the data transfer. After the completion of data transfer, it returns control to the main program to the point it was interrupted.
- DMA — Direct Memory Access:
DMA transfer is used for large data transfers. Here, a memory bus is used by the interface to transfer data in & out of a memory unit. The CPU provides starting address & number of bytes to be transferred to the interface to initiate the transfer, after that it proceeds to execute other tasks. DMA requests a memory cycle through the memory bus when the transfer is made. DMA transfers the data directly into the memory when the request is granted by the memory controller. To allow direct memory transfer(I/O), the CPU delays its memory access operation. So, DMA allows I/O devices to directly access memory with less intervention of the CPU.
Difference between I/O Program Controlled Transfer & DMA Transfer
|S.No.||I/O Program Controlled Transfer||DMA Transfer|
|1.||It is software control data transfer||It is hardware control data transfer|
|2.||Data transfer speed is slow||Data transfer speed is fast.|
|3.||CPU is involved in the complete transfer.||CPU is not involved in the complete transfer.|
|4.||Extra hardware is not required.||DMA controller is required for data transfer.|
|5.||Data is routed through the processor, during the data transfer.||Data is not routed through the processor, during the data transfer.|
|6.||Used for small data transfer.||Used for large data transfer.|