Input Output Communication Techniques in Operating System
Data transfer between the CPU and I/O devices may be handled in a variety of techniques. Some techniques use the CPU as an intermediate path, others transfer the data directly to and from the memory unit. Data transferred to and from peripherals is said to be I/O communication. Generally, I/O communication is done in 3 ways. These are
1. Programmed I/O
2. Interrupt-initiated I/O
3. Direct Memory Access (DMA)
In the programmed I/O method, the I/O device doesn’t have direct access to memory. The data transfer from an I/O device to memory requires the execution of a program or several instructions by CPU So that this method is said to be Programmed I/O. In this method, the CPU stays in a program loop until the I/O unit indicates that is ready for data transfer. It is a time-consuming process for CPU. The programmed I/O method is particularly useful in small low-speed computers.
The CPU sends the ‘Read‘ command to I/O device and wait in the program loop until it receives a response from I/O device.
The problem in programmed I/O is that the CPU has to wait for the ready signal from the I/O device. The alternative method for this problem is Interrupt-initiated I/O or Interrupt driven I/O. In this method, the CPU issue a read command to I/O device about the status, and then go on to do some useful work. When the I/O device ready, the I/O device sends an interrupt signal to the processor.
When the CPU received the interrupt signal from I/O device, it checks the status, if the status is ready, then the CPU read the word form I/O device and write the word into the main memory. If the operation was done successfully, then the processor goes on to the next instruction.
Direct Access Memory (DMA):
Direct Memory Access (DMA) is a process where the data is transformed between the microprocessor (CPU), memory and peripheral devices directly without the involvement of the microprocessor (CPU). It is first initialized by CPU and the CPU should send some useful information to DMA controller and letting the DMA controller is to manage the memory buses directly, it would improve the speed of data transfer. This process is managed by a chip known as a DMA Controller (DMAC). The CPU is idle and it has no control of the memory buses. A DMA controller takes over the buses to manage the transfer directly between the I/O device and memory.