Operating System I/O Software

FREE Online Courses: Click for Success, Learn for Free - Start Now!

I/O Software helps the user interact with I/O hardware. Independence is a key concept of I/O software. It means that a program should be able to access an I/O device without specifying the device in advance. I/O software is organized in the following three layers:

1. User-Level Libraries: This provides a simple interface to a program so that it can perform input and output.

2. Kernel-Level Modules: They have device drivers that interact with device-controllers and device independent I/O modules.

3. Hardware: This includes hardware and hardware controllers that interact with device drivers.

Device Drivers

Software modules that can be plugged into an OS in order to handle any device are known as device drivers. They help the OS handle I/O devices. Device drivers have device-dependent codes containing device-specific register reads/writes that help implements a standard interface. They are written by a device’s manufacturer and are stored on a CD-ROM and sent with the device.

The job of a device driver is to:

  • Accept requests from the device-independent software
  • Interact with the device controller in order to take/give inputs and outputs
  • Perform error handling as and when required
  • Make sure that the execution of requests is successful

If the device driver is idle when a request arrives, it proceeds to carry out the request. Otherwise, it places the new request in the queue of pending requests.

Interrupt handlers

An interrupt handler or interrupt service routine (ISR), is a part of software. It is more like a callback function in an OS (device driver) that starts execution after receiving an interrupt. Thus, interrupt is like a trigger for interrupt handlers.

The interrupt takes many measures to handle an interrupt like updating data structures and waking up the process waiting for the interrupt. The interrupt mechanism accepts an address, an offset stored in the interrupt vector table.

Operating System Device-Independent I/O Software

Technology is evolving rapidly!
Stay updated with DataFlair on WhatsApp!!

A device-independent software performs I/O functions common to all devices and provides a uniform interface user-level softwares. Though writing completely device-independent software is difficult, modules that are common among all devices can be written relatively easily.

Functions of device-independent I/O software are:

  • Uniform interfacing
  • Device naming
  • Device security
  • Provides device-independent block sizes
  • Buffering
  • Storage allocation
  • Allocating and releasing devices
  • Reporting of errors

Operating System User-Space I/O Software

This provides a rich and simple interface that allows a user to access the functionality of the kernel. A user-level I/O software usually contains library procedures. Though there are exceptions like the spooling system that deals with dedicated I/O devices. User-space contains I/O Libraries that provide an interface to the device-independent I/O software residing in the OS.

Kernel I/O Subsystem

Kernel I/O Subsystem provides services that are related to I/O. Some of these services are:

1. Scheduling: Kernel determines a good order to execute I/O requests and schedules them accordingly. When a device issues a blocking I/O system call, the kernel places the request on queue. The kernel also arranges this queue in order to improve the efficiency and average response time of a system.

2. Buffering: It maintains a buffer that stores the data being transferred between two devices. This helps cope with a speed mismatch or to adapt between devices with different data transfer sizes.

3. Caching: Kernel stores the data copies in cache memory. It is easier to access the cached copy than the original.
Spooling and Device Reservation: It handles spooling of data. Like in the case of a printer, copying each queued spool file to the printer at a time.

4. Error Handling: An OS with protected memory is capable of guarding against hardware and application errors.

5. Uniform Naming: Multiple disks are integrated into the file-system hierarchy in reasoned ways. Due to this, the user is unaware of corresponding file names.

6. Synchronous and Asynchronous transfers: Usually physical I/Os are asynchronous in nature, but some high-performance applications control their details. Thus, some OS make asynchronous I/O available to them.

7. Sharable and Dedicated devices: There are many I/O devices like disks that multiple users can use at the same time. Whereas some devices like printers are dedicated devices, dedicated to a single user at a time. Dedicated devices may cause deadlocks but it is up to the OS how to avoid problems.

Summary

I/O Software helps the user interact with I/O hardware. It is divided into three levels, namely, user-level libraries, kernel-level modules, and hardware. The device driver interacts with device controllers. An interrupt is like a callback function in an OS.

Did we exceed your expectations?
If Yes, share your valuable feedback on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *