Home >>Operating System Tutorial >Operating System I/O Softwares

Operating System I/O Softwares

Operating System I/O Softwares

In the following layers, I/O software is also organised

User Level Libraries − This provides the user programme with a simple interface to execute input and output. Studio, for instance, is a library provided by the programming languages C and C++.

Kernel Level Modules − This helps the device driver to interact with the device controller and system-independent I/O modules that device drivers use.

Hardware − This layer contains the actual hardware and hardware controller that interacts with the device drivers and keeps the hardware alive.

A key concept in I / O software design is that it should be device-independent where it should be possible to write programmes that can reach any I/O device without defining the device advance. For example, a programme that reads a file as input should be able to read a file on a disk, a hard disk or a CD-ROM without changing the programme for each device.

Operating System

Device Drivers

Device drivers are software modules that can be plugged into an operating system to handle a specified device. Operating System is supported by computer drivers in managing all I / O devices. Device drivers encapsulate device-dependent code and enforce a standard interface so that code includes reads / writes for device-specific register. Device driver, usually written by the manufacturer of the device and distributed on a CD-ROM along with the device.

A device driver does the following tasks −

  • To accept request from the app separate from the device above.
  • Interact with the device controller to take and provide I/O and perform the error handling necessary
  • Ensure the request is successfully performed

How a device driver handles a request is as follows: Assume a request comes for a block N to be read. If at the time a request arrives, the driver is idle, it instantly begins performing the request. If otherwise, the driver is already busy with some other request, the new request is put in the queue of pending requests.

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

When the interrupt occurs, the interrupt procedure does all it has to manage the interrupt, changes data structures and wakes up operation waiting for an interrupt.

The interrupt mechanism accepts a number address that selects from a small collection a particular interrupt handling routine/function. The address is an offset stored in a table called the interrupt vector table in most architectures. This vector contains specialised interrupt handler memory addresses.

Device-Independent I/O Software

The basic purpose of the device-independent software is to perform the I/O functions common to all devices and to provide the user-level software with a standardised interface. Although writing device-independent software is difficult, we can write some modules common to all devices. The following is a list of device-independent I / O Software functions –

  • Uniform device-driver interface
  • Unit naming-Mnemonic names mapped to system numbers Major and Minor
  • Device protection
  • Providing a block size independent of the device
  • Buffering because data can not be stored in the final destination while a device is coming off.
  • Allocation of storage over block devices
  • Allocating and launching of dedicated devices
  • Mistake Reporting

User-Space I/O Software

These are the libraries that provide a richer and simpler interface for accessing the kernel's features, or essentially interactive with the device drivers. Most user-level I/O software consists of library procedures with some exception, such as spooling system, which in a multiprogramming system is a way to deal with dedicated I / O devices.

I/O libraries (e.g. stdio) provide an interface to the OS-resident device-independent I / O SW in the userspace. For example, putchar), (getchar), (printf) (and scanf) (are examples of user-level I/O library stdio available in C programming.

Kernel I/O Subsystem

Kernel I/O Subsystem is responsible for providing many I/O-related services. Any of the services given are thereafter.

Scheduling − Kernel schedules a set of I/O requests to decide how to execute them in good order. When an application makes a system call for blocking I / O, the request for that device is put on the queue. The Kernel I / O scheduler rearranges the queue order to increase the overall efficiency of the system and the average response time that apps experience.

Buffering − Kernel I/O Subsystem maintains a memory area known as a buffer which stores data while it is being transferred between two devices or between an application operating device. Buffering is done to deal with a speed difference between the manufacturer and the consumer of a data stream or to adjust to devices with different data sizes.

Caching − Kernel maintains cache memory which is a fast memory region holding copies of the data. More productive access to the cached copy than access to the original.

Spooling and System Reservation − A spool is a buffer that stores information for a system that can not accept interleaved data streams, like a printer. The spooling method copies one at a time, the queued spool files to the printer. In certain operating systems a system daemon mechanism is used to manage to the spool. An in-kernel thread is managed in other operating systems.

Error Handling − An operating system that uses protected memory can defend against several types of errors in hardware and applications.


No Sidebar ads