top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Explain programmed I/O and interrupt I/O. How they differ

+4 votes
13,112 views
Explain programmed I/O and interrupt I/O. How they differ
posted Apr 22, 2015 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Programmed I/O

Programmed I/O (PIO) refers to data transfers initiated by a CPU under driver software control to access registers or memory on a device.

The CPU issues a command then waits for I/O operations to be complete. As the CPU is faster than the I/O module, the problem with programmed I/O is that the CPU has to wait a long time for the I/O module of concern to be ready for either reception or transmission of data. The CPU, while waiting, must repeatedly check the status of the I/O module, and this process is known as Polling. As a result, the level of the performance of the entire system is severely degraded.

Programmed I/O basically works in these ways:

CPU requests I/O operation

I/O module performs operation

I/O module sets status bits

CPU checks status bits periodically

I/O module does not inform CPU directly

I/O module does not interrupt CPU

CPU may wait or come back later

Interrupt

The 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.

For input, the device interrupts the CPU when new data has arrived and is ready to be retrieved by the system processor. The actual actions to perform depend on whether the device uses I/O ports, memory mapping.

For output, the device delivers an interrupt either when it is ready to accept new data or to acknowledge a successful data transfer. Memory-mapped and DMA-capable devices usually generate interrupts to tell the system they are done with the buffer.

Although Interrupt relieves the CPU of having to wait for the devices, but it is still inefficient in data transfer of large amount because the CPU has to transfer the data word by word between I/O module and memory.

Below are the basic operations of Interrupt:

CPU issues read command

I/O module gets data from peripheral whilst CPU does other work

I/O module interrupts CPU

CPU requests data

I/O module transfers data

Difference between Programmed I/O and Interrupt I/O

Programmed I/O

  • It used only in some low-end microcomputers.

  • It has single input and single output instruction.

  • Each instructions selects one I/O device (by number) and transfers a single character (byte)

  • Four registers: input status and character, output status and character.

Interrupt-driven I/O

  • Primary disadvantage of programmed I/O is that CPU spends most of its time in a tight loop waiting for the device to become ready. This is called busy waiting.

  • With interrupt-driven I/O, the CPU starts the device and tells it to generate an interrupt when it is finished.

  • Done by setting interrupt-enable bit in status register.

  • Still requires an interrupt for every character read or written.

  • Interrupting a running process is an expensive business (requires saving context).

  • Requires extra hardware (DMA controller chip).

answer Apr 22, 2015 by Shivaranjini
...