Skip to main content

Disk scheduling; device-independent I/O software

Short answer

Disk scheduling orders pending I/O requests to minimize seek time; common algorithms include FCFS, SSTF, SCAN, C-SCAN, LOOK. Device-independent I/O software provides a uniform interface to drivers, with buffering, error reporting, naming, protection, caching, scheduling, and device-independent block size. Example: write(fd,buf,n) works identically for disk, USB, or terminal.

What is disc scheduling? Explain details about the device independent I/O software with example.

Disk scheduling

Disk scheduling is the method by which the OS decides the order in which pending disk I/O requests are served, in order to reduce the total seek time (arm movement) and improve throughput and fairness. Disk access time = seek time + rotational latency + transfer time; seek time is the largest part and the only one the scheduler can reduce easily.

Common algorithms:

AlgorithmIdeaRemark
FCFSServe in arrival orderFair, but long arm movement
SSTF/SSFServe the nearest cylinder firstLow movement; starvation possible
SCAN (elevator)Move in one direction serving requests to the disk end, then reverseNo starvation, good for heavy load
C-SCANServe in one direction only; on reaching the end return to startMore uniform waiting time
LOOK / C-LOOKLike SCAN/C-SCAN but turn back at the last requestLess movement

Example: head at 50, queue 90, 20, 60. FCFS: 40 + 70 + 40 = 150. SSTF (60, 90, 20): 10 + 30 + 70 = 110.

Device-independent I/O software

Device-independent I/O software is the layer of the OS that performs I/O functions common to all devices and gives a uniform interface to the user-level programs, so that device specific details remain in the drivers.

Functions:

  1. Uniform interfacing for device drivers: all drivers present the same functions to the kernel, so a new driver can be added without changing the OS.
  2. Buffering: holds data temporarily in kernel buffers (user buffer vs kernel buffer, double buffering) to cope with speed differences.
  3. Error reporting: handles programming errors (illegal operation) and passes on actual I/O errors.
  4. Allocating and releasing dedicated devices: devices such as printers and tapes are given to one process at a time (open/close).
  5. Providing a device-independent block size: hides different sector sizes of disks by presenting a uniform logical block size.
  6. Naming and protection: device names (such as /dev/sda) map to the proper driver; access permissions are checked.
  7. Caching and scheduling: block cache and disk scheduling.

Example: a program calls write(fd, buf, n). The call works the same whether fd refers to a file on a disk, a USB drive or the terminal; the device-independent layer checks permissions, buffers the data and selects the driver, and only then the driver talks to the specific controller.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Operating System chapter 6 questions →