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 the errant processes and malicious users.
- I/O Scheduling –
To schedule a set of I/O request means to determine a good order in which to execute them. The order in which application issues the system call are 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 scheduling 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 rearrange the order to improve the efficiency of the system.
- 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.
- First is to cope with a speed mismatch between producer and consumer of a data stream.
- The second use of buffering is to provide adaptation for that have different data-transfer size.
- 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 disk that is stored in its buffer. it calls the write() system s=call, providing a pointer to the buffer and the integer specify the number of bytes to write.
After the system call returns, what happens if the application of the buffer changes the content of the buffer? With copy semantic, the version of the data written to the disk is guaranteed to be the version at the time of the application system call.
- Caching –
A cache is a region of fast memory that holds 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 copies 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 data item, while cache, by definition, holds a copy on faster storage of an item that resides elsewhere.
- 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 stream. 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 continuing to the printer. 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.
- 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.
- I/O Protection –
Errors and the issue of protection are closely related. A user process may attempt to issue illegal I/O instruction 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 instruction to be privileged instructions. The user cannot issue I/O instruction directly.
- Difference between Operating System and Kernel
- Allocating kernel memory (buddy system and slab system)
- System Protection in Operating System
- Functions of Operating System
- Paging in Operating System
- Thread in Operating System
- Segmentation in Operating System
- Introduction of Operating System - Set 1
- Inode in Operating System
- Multithreading in Operating System
- Boot Block in Operating System
- Operating System | Allocation of frames
- Benefits of Multithreading in Operating System
- Comparison on using Java for an Operating System instead of C
- Non-Contiguous Allocation in Operating System
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shreyashagrawal