Skip to content
Related Articles
Open in App
Not now

Related Articles

Kernel I/O Subsystem in Operating System

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 01 Apr, 2021
Improve Article
Save Article

Prerequisite – Microkernel 
The kernel provides many services related to I/O. Several services such as scheduling, caching, spooling, device reservation, and error handling – are provided by the kernel, s I/O subsystem built on the hardware and device-driver infrastructure. The I/O subsystem is also responsible for protecting itself from errant processes and malicious users. 


  1. I/O Scheduling – 
    To schedule a set of I/O requests means to determine a good order in which to execute them. The order in which the application issues the system call is the best choice. Scheduling can improve the overall performance of the system, can share device access permission fairly to all the processes, reduce the average waiting time, response time, turnaround time for I/O to complete. 

    OS developers implement schedules by maintaining a wait queue of the request for each device. When an application issue a blocking I/O system call, The request is placed in the queue for that device. The I/O scheduler rearranges the order to improve the efficiency of the system. 

  2. Buffering – 
    A buffer is a memory area that stores data being transferred between two devices or between a device and an application. Buffering is done for three reasons. 
    1. The first is to cope with a speed mismatch between producer and consumer of a data stream. 
    2. The second use of buffering is to provide adaptation for data that have different data-transfer sizes. 
    3. The third use of buffering is to support copy semantics for the application I/O, “copy semantic ” means, suppose that an application wants to write data on a disk that is stored in its buffer. it calls the write() system’s call, providing a pointer to the buffer and the integer specifying the number of bytes to write. 
  3. Caching – 
    A cache is a region of fast memory that holds a copy of data. Access to the cached copy is much easier than the original file. For instance, the instruction of the currently running process is stored on the disk, cached in physical memory, and copied again in the CPU’s secondary and primary cache. 

    The main difference between a buffer and a cache is that a buffer may hold only the existing copy of a data item, while a cache, by definition, holds a copy on faster storage of an item that resides elsewhere. 


  4. Spooling and Device Reservation – 
    A spool is a buffer that holds the output of a device, such as a printer that cannot accept interleaved data streams. Although a printer can serve only one job at a time, several applications may wish to print their output concurrently, without having their output mixes together. 

    The OS solves this problem by preventing all output from continuing to the printer. The output of all applications is spooled in a separate disk file. When an application finishes printing then the spooling system queues the corresponding spool file for output to the printer. 


  5. Error Handling – 
    An Os that uses protected memory can guard against many kinds of hardware and application errors so that a complete system failure is not the usual result of each minor mechanical glitch, Devices, and I/O transfers can fail in many ways, either for transient reasons, as when a network becomes overloaded or for permanent reasons, as when a disk controller becomes defective. 


  6. I/O Protection – 
    Errors and the issue of protection are closely related. A user process may attempt to issue illegal I/O instructions to disrupt the normal function of a system. We can use the various mechanisms to ensure that such disruption cannot take place in the system. 

    To prevent illegal I/O access, we define all I/O instructions to be privileged instructions. The user cannot issue I/O instruction directly. 


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!