Javatpoint Logo
Javatpoint Logo

Input/Output Hardware and Input/Output Controller

In this article, we understand about the Input/Output Hardware and Input/Output Controller in detail.

Input/Output Hardware

In order to manage and control the various I/O device attached to computer, I/O system requires some hardware and software components. I/O devices commonly use certain hardware devices. These are: system bus and ports.

  • Ports are the plugs used to connect I/O devices to the computer.
  • Bus is a set of wires to which these ports and I/O controllers are connected and through which signals are send for 1/O command.

Input/Output Controller

Input/Output Controller is a component that attaches with each device and is used to accept input and provide output to these devices. Applications access I/O devices with the help of these I/O controllers. Thus I/O controller is a peripheral device that enables the main processor to transfer data between the host system and I/O devices. The I/O controller is a special purpose processor and are autonomous in nature. Autonomous means that I/O controllers carry out operations on I/O devices while the main CPU continues to execute programs.. The CPU controls the activities of an I/O controller by writing into and reading from I/O ports. I/0 controllers have certain registers to store data and control signals. These registers are:

  1. The Control register contains that show the functioning of devices i.e. one bit shows whether the device communicates in half duplex or full duplex mode, another bit shows party checking and third bit shows the word length of data.
  2. The Status register holds bits that show the status of I/O command. These bits indicate the success, busy or failure status of a command.
  3. Input registers contain the input read by the end user.
  4. The output registers hold the output written by the host. The program counter holds the address of next instruction to be executed by the processor.

Polling

Polling is a technique used by units such as CPU or a program to check the status of I/O devices. If the device is not in the required status, checking unit will continue with its work without waiting for the device to achieve required status Polling is also called busy-waiting because a device is busy in checking the status of other device. Polling is a common approach to handling multiple I/O device by expanding the busy-waiting loop of checking status. When a device is found with the desired status CPU branch the device with corresponding Interrupt Service Routine (ISR) so that interrupts produced by that device is handled by ISR. ISR, after performing an I/O operation, terminates. The device is again branched into the busy-waiting loop. Busy-wait loop ensures that CPU services each device as status of device is checking continuously.

Interrupts

Whenever a process needs to perform I/O it can use an interrupt. Interrupts stop the execution of a program to perform other tasks, such as numerical computation. Interrupt signal an event to occur. If an interrupt occurs, the CPU stores the current status of the process in the program registers and stop the program execution. CPU starts executing the interrupt. When CPU finishes its processing, it regains the status of process and continue its execution. I/O devices that halt the normal functioning of the processor generate various types of interrupts:

  1. Program Interrupt. Generated by a program when one of its statements causes error, such as division by zero, data mismatch and arithmetic overflow.
  2. Time Interrupt. Generated by the inbuilt timer in a processor to perform certain functions that are required at regular time intervals.
  3. I/O Interrupts. Generated by I/O hardware or by the controller to inform an end user about the completion of an I/O operation or about errors, if any, that occurred at the time of execution of a program.
  4. Hardware Failure Interrupt. Generated by the hardware if any problem occurs, such as parity error or power failure.
  5. Supervisor Call (SVC) Interrupts. Generated by the process itself at the time of execution if it needs an I/O operation to be performed.
  6. Restart Interrupts. Generated when the restart button of the console is pressed.

For each kind of interrupt, codes are written in operating system. These are called Interrupt Service Routine (ISR). It then decides the necessary steps that are taken when a particular interrupt occurs. Operating system handles interrupts in two manners:

  1. Synchronous I/O. Halts the program and execute the I/O operation. After the completion of the I/O operation; the previous state of the program is resumed. At the time of processing, I/O operation CPU remains idle.
  2. Asynchronous I/O. Execute the 1/0 operation without halting the program in between. The I/O operations run with other operations of a program simultaneously.






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA