Differentiate between programmed I/O and interrupt driven I/O.


The differences between programmed (Input/Output) I/O and interrupt-driven I/O are as follows −

Programmed I/O

This I/O technique is the simplest to exchange data between external devices and processors. In this technique, the processor or Central Processing Unit (CPU) runs or executes a program giving direct control of I/O operations.

Processor issues a command to the I/O module and waits for the operation to complete. Also, the processor keeps checking the I/O module status until it finds the completion of the operation.

The processor's time is wasted, in case the processor is faster than the I/O module. Its module is considered to be a slow module.

Its application is in certain low-end microcomputers. It has a single output and single input instruction.

Each one of the instructions selects only one I/O device by number and transfers only a single character by byte. Four registers are involved in this technique and they are output status and character and input status and character.

Its disadvantage is busy waiting which means the processor consumes most of its time in a tight loop by waiting for the I/O device to be ready to be used. Program checks or polls an I/O hardware component, device, or item.

For Example − A computer mouse that is within a loop.

It is easy to understand. It is easy to program. It is slow and inefficient.

The system's performance is degraded, severely. It does not require initializing the stack.

System's throughput is decreased due to the increase in the number of I/O devices connected in the system. The best example is that of the PC device Advanced Technology Attachment (ATA) interface using programmed I/O.

Interrupt-driven I/O

It is similar to the programmed-driven I/O technique. The processor does not wait until the I/O operation is completed. The processor performs other tasks while the I/O operation is being performed.

When the I/O operation is completed, the I/O module interrupts the processor letting the processor know the operation is completed. Its module is faster than the programmed I/O module.

The processor actually starts the I/O device and instructs it to generate and send an interrupt signal when the operation is finished. This is achieved by setting an interruptenabled bit in the status register.

This technique requires an interrupt for each character that is written or read. It is an expensive business to interrupt a running process as it requires saving context.

It requires additional hardware such as a Direct Memory Access (DMA) controller chip. It is fast and efficient.

It becomes difficult to code, in case the programmer is using a low-level programming language. It can get difficult to get the various pieces to be put to work well together. This is done by the OS developer, for example, Microsoft or the hardware manufacturer.

The system's performance is enhanced. It requires initializing the stack.

The system's throughput is not affected despite the number of I/O devices connected in the system increasing as the throughput does not rely on the number.

For Example − The computer mouse triggers and sends a signal to the program for processing the mouse event.

Interrupt-driven I/O is better as it is fast, efficient. The system's performance is improved and enhanced.

Updated on: 29-Nov-2021

13K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements