Home » Operating Systems

Kernel I/O Subsystem in Operating System

Operating system Kernel I/O subsystem: In this tutorial, we are going to learn about the kernel input/output (I/O) subsystem in Operating System.
Submitted by Monika Jha, on September 23, 2019

Kernel Input / Output subsystem

Input and output (I/O) devices permit us to communicate with the computer system. I/O is the transfer of data between RAM and various I/O peripherals. By using Input devices such as keyboards, mouse, card readers, scanners, voice recognition systems, and touch screens we can enter data into the computer. y using output devices such as monitors, printers, plotters, and speakers allow us to get information from the computer.

These devices directly not connected with the CPU. But there is an interface that manages the data transfers between them. The system bus signals converted to and from a format that is acceptable to the given device by this interface. Communication between these external devices and processor is done via I/O registers.

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, and build on the hardware and device driver infrastructure.

We will discuss kernel services such as I/O scheduling, Caching, Buffering, Spooling, Device Reservation, I/O Protection, and Error Handling.

1) Scheduling

It means to determine a good order in which to execute input/output requests called disk scheduling.

Scheduling I/O requests can greatly improve overall efficiency. Priorities can also play a vital role in request scheduling and can reduce the average waiting time for I/O to complete.

By this device access, permissions will be fair to all jobs. When an application issues a blocking I/O system call, the request is placed on the job queue for that device. The order of the queue rearranges by the Kernel I/O scheduler to improve the overall system efficiency.

2) Caching

It involves keeping a copy of data in a faster access location than where the data is normally stored.

For example, when you request a file by looking at a Web page are stored on your hard disk in a cache subdirectory under the directory for your browser. When you get back to a page you have recently visited, the browser can get those files from the cache rather than the original server, saving you time and saving the network the burden of additional traffic.

There is a difference between cache and buffer is cache is a duplicate copy of some other data stored elsewhere whereas buffer stores copy of an existing data item.

3) Buffering

Buffer is a memory area maintains by Kernel I/O Subsystem that stores data while they are transferred between two devices or between a device with an application.

Buffering is done for three reasons.

  1. One reason is to adapt to devices that have different data transfer sizes.
  2. A second use of buffering is to support copy semantics for an application I/O. An application wants to write data on disk which is stored in its buffer, it is called “copy semantic ”. it calls the write() system call, providing a pointer to the buffer and the integer specify the number of bytes to write.
  3. A third one is to cope with the speed mismatch between the producer and consumer of the data stream.

4) Spooling

A spool is a type of buffer that holds output for a device. It is the process in which jobs from the cards are read directly onto the disk and the location of that card in the disk is recorded in a table by the operating system. When that job is required for execution, it is read from the disk.

For example, several applications may wish to print their output concurrently, so spooling solves this problem by maintaining a queue for the output. A printer does not accept interleaved data. The output of all application 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) Device Reservation

It provides exclusive device access. Allocation of devices when required by the processes and that device when it is no longer needed. It prevents deadlock. Many operating systems provide features that enable processes to coordinate and give exclusive access to them.

6) I/O Protection

I/O must be performed via system calls. User processes may accidentally or purposefully attempt to disrupt normal operation via illegal I/O instructions. To prevent a user from do all I/O instructions defined to be privileged.

7) Error Handling

An operating system that uses protected memory that can guard against many kinds of hardware and application errors. Devices and I/O transfers may fail in some manner, either for transient reasons, as when a network becomes overloaded or for permanent reasons, as when a disk controller becomes defective.

Comments and Discussions

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.