In: Computer Science
Explain how a read I/O operation happens in 2 scenarios: with DMA and without DMA. Clearly explain how the I/O device and the CPU works concurrently in both cases. Explain through an example showing the steps of the protocols and the algorithms underneath.
I/O operation is transferring the information from internal storage(RAM) to external I/O devices(monitor,keyboard,mouse,hard disk).This operation is used to provide a communication link between CPU and peripherals.
There are majorly three possible ways to transfer the data:
1 Programmed I/O
2.Interrupt initiated I/O
3.Direct Memory Access
Let's discuss each mode in detail
1.Programmed I/O:It is a set of instructions that is written in a computer program by which an instruction is used to transfer the data.Transferring data will be from CPU register to memory.in this scenario the I/O doesn't have direct access to memory unit.For each operation there will be instruction to transfer data. Mean time CPU waits for the signal from I/O unit.This process is time consuming.
2.Interrupt Initiated I/O: CPU ideal time can be avoided with interrupt initiated I/O because interrupt I/O uses interrupt driven method to transfer the data.whenever the data is ready to transfer I/O will initiate the interrupt to CPU so that CPU can interrupt current process and transfer the I/O data . It reduces the time consuming.
Note:Both the above methods of transferring data is limited by speed of the processer.
3.Direct Memory Access:In this operation we allow the peripherals to directly communicate with memory buses.CPU interventions will be reduced.DMA directly transfers the data between I/O devices and memory unit with the help of DMA.DMA controller is a device that is programmed to perform a sequence of data transfer on behalf of CPU.
step 1:DMA request I/O device
Step 2:DMA acknowledge with DMA controller
Step 3: Memory read with DMA controller
Step 4: Memory address with DMA controller
step 5:Data transfer withI/O device