Operating System – I/O Softwares

Device driver starts I/O and blocks (e.g., down a mutex) Interrupt wakes up driver. Process an interrupt. Save registers ( which to where?) Set up context (TLB, MMU, page table) Run the handler (usually the handler will be blocked) Choose a process to run next. Load the context for the newly selected process. Run the process. Interrupts are used for most I/O. The steps of interrupt has been studied before. For details, please refer to page

I/O Software is used for interaction with I/O devices like mouse, keyboard, USB devices, printers, etc. I/O software are organized in following ways:

User Level Libraries– Provides an simple interface to program for input output functions.
Kernel Level Modules– Provides device driver to interact with the device independent I/O modules and device controller.
Hardware-A layer including hardware controller and actual hardware which interact with device drivers.

Device Drivers

Device drivers are software modules that can be plugged into an OS to handle a particular device. Operating System takes help from device drivers to handle all I/O devices. Device drivers encapsulate device-dependent code and implement a standard interface in such a way that code contains device-specific register reads/writes. Device driver, is generally written by the device’s manufacturer and delivered along with the device on a CD-ROM.

A device driver performs the following jobs −

  • To accept request from the device independent software above to it.
  • Interact with the device controller to take and give I/O and perform required error handling
  • Making sure that the request is executed successfully

Interrupt handlers

An interrupt handler, also known as an interrupt service routine or ISR, is a piece of software or more specifically a callback function in an operating system or more specifically in a device driver, whose execution is triggered by the reception of an interrupt.

When the interrupt happens, the interrupt procedure does whatever it has to in order to handle the interrupt, updates data structures and wakes up process that was waiting for an interrupt to happen.

Device-Independent I/O Software

The basic function of the device-independent software is to perform the I/O functions that are common to all devices and to provide a uniform interface to the user-level software. Though it is difficult to write completely device independent software but we can write some modules which are common among all the devices. Following is a list of functions of device-independent I/O Software −

  • Uniform interfacing for device drivers
  • Device naming – Mnemonic names mapped to Major and Minor device numbers
  • Device protection
  • Providing a device-independent block size
  • Buffering because data coming off a device cannot be stored in final destination.
  • Storage allocation on block devices
  • Allocation and releasing dedicated devices
  • Error Reporting

Next :Operating System – File System