Kernel I/O subsystem provides various services like scheduling, buffering, caching, spooling, device reservation and error handling.
Kernel I/O Subsystem
• Kernel I/O subsystem provides
various services like scheduling, buffering, caching, spooling, device
reservation and error handling.
1. I/O scheduling:
Some I/O request ordering via per-device queue. Scheduling can improve overall
system performance. Operating-system developers implement scheduling by
maintaining a queue of requests for each device.
2.
Buffering: Buffer
is a memory area that stores data while they are transferred between two
devices or between a device and an application.
3. Caching:
It is fast memory region which holds copies of data. Access to the cached copy
is more efficient than access to the original. Cache files that are
read/written frequently. Caching increases performance.
4. Spooling and device reservation
: Spooling uses the disk as a large buffer for Jerit and outputting data to
printers and other devices. It can also be used for input, but is generally
used for output. Its main use is to prevent two users from alternating printing
lines to the line printer on the same page, getting their output completely
mixed together. It also helps in reducing idle time and overlapped I/O
5. Error handling:
Most operating systems return an error number or code when I/O request fails.
OS can recover from disk read, device unavailable, transient write failures.
6. I/O protection:
User application may accidentally attempt to disrupt normal operation via
illegal I/O instructions. To avoid this we can use all I/O instructions defined
to be privileged and I/O must be performed via system calls.
7.
Kernel data structures:
Kernel keeps state info for I/O components, including open file tables, network
connections, character device state. The kernel must create a data structure
representing the new process. The scheduler can then use it if it decides to
schedule that process to run when it is its turn.
• Reading a file from disk, application
refers to the data by a file name. On the secondary storage device, file system
maps from the file name through the directory.
• In UNIX operating system, the name
maps to an inode number and that inode contains the space-allocation
information.
•
UNIX represents device names in the regular file-system name space. To resolve
a Se path name, UNIX looks up the name in the mount table to find the longest
matching prefix; the corresponding entry in the mount table gives the device
name.
•
UNIX uses concept of major and minor number. Device files are found in the /dev
directory. Each device is assigned a major and minor device number. bod
• The major device number identifies the
type of device, i.e. all SCSI devices would have the same number as would all
the keyboards. The minor device number identifies a specific device, i.e. the
keyboard attached to this workstation.
• Consider reading a file from disk for a process :
1. Determine device holding file.
2. Translate name to device
representation.
3.
Physically read data from disk into buffer.
4.
Make data available to requesting process.
5.
Return control to process.
University Question
Introduction to Operating Systems: Unit IV(a): Storage Management : Tag: : Storage Management - Introduction to Operating Systems - Kernel I/O Subsystem
Introduction to Operating Systems
CS3451 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation