Interrupt driven I/O
- Interrupt driven I/O means CPU issues commands to the I/O module then proceeds with its normal work until interrupted by I/O device on completion of its work.
- The problem with the programmed I/O is that the processor has to wait a long time for the input/output module of concern to be ready for either reception or transmission of more data.
- The processor, while waiting, must repeatedly interrogate the status of the Input/ Output module. As a result the level of performance of entire system is degraded.
- An alternative approach for this is interrupt driven Input / Output. The processor issue an Input/output command to a module and then go on to do some other useful work. The input/ Output module will then interrupt the processor to request service, when it is ready to exchange data with the processor.
- The processor then executes the data transfer as before and then resumes its former processing.
- Interrupt-driven input/output still consumes a lot of time because every data has to pass with processor.
Direct Memory Access (DMA) means CPU grants I/O module authority to read from or write to memory without involvement.
The previous ways of I/O suffer from two inherent drawbacks.
a) The I/O transfer rate is limited by the speed with which the processor can test and service a device.
b) 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. The DMA function can be performed by a separate module on the system bus, or it can be incorporated into an I/O module. In either case , the technique works as follow.
When the processor wishes to read or write a block of data, it issues a command to the DMA module by sending the following information.
- Whether a read or write is requested.
- The address of the I/O devices.
- Starting location in memory to read from or write to.
- The number of words to be read or written.
The processor then continues with other work. It has delegated this I/O operation to the DMA module, and that module will take care of it. The DMA module transfers the entire block of data, one word at 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 at the end of the transfer.
In programmed I/O CPU takes care of whether the device is ready or not. Data may be lost. Whereas in Interrupt-driven I/O, device itself inform the CPU by generating an interrupt signal. If the data rate of the I/O is too fast. Data may be lost. In this case CPU most be cut off, since CPU is too slow for the particular device. The initial state is too fast. It is meaningful to allow the device to put the data directly to the memory. This is called DMA. DMA controller will take over the task of CPU. CPU is general purpose but the DMA controller is specific purpose.
A DMA module controls the exchange of data between main memory and an I/O module. The processor sends a request for the transfer of a block of data to the DMA module and is interrupted only after the entire block has been transferred.