---
title: "Disk scheduling; device-independent I/O software"
subject: "Operating System"
chapter: 6
key: "semester_6/operating_system:disk-scheduling-device-independent-io"
source: https://www.bctengineer.com/q/semester_6/operating_system/disk-scheduling-device-independent-io
site: BCT Engineering
---

# Disk scheduling; device-independent I/O software

Operating System · Chapter 6: I/O Management and Disk Scheduling

- Asked in: 2072 Asoj, 3+6 marks
- Video: [6.04 - Device Independent IO Software](https://www.youtube.com/watch?v=sA_m4F7Fhpc) — Darshan University
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/disk-scheduling-device-independent-io
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-6

## Question

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

## 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.

## Answer

#### 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:
| Algorithm | Idea | Remark |
|---|---|---|
| FCFS | Serve in arrival order | Fair, but long arm movement |
| SSTF/SSF | Serve the nearest cylinder first | Low movement; starvation possible |
| SCAN (elevator) | Move in one direction serving requests to the disk end, then reverse | No starvation, good for heavy load |
| C-SCAN | Serve in one direction only; on reaching the end return to start | More uniform waiting time |
| LOOK / C-LOOK | Like SCAN/C-SCAN but turn back at the last request | Less 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.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is the main aim of disk scheduling?
   A. Increase the size of the disk cache
   B. Reduce the transfer time of each sector
   C. Reduce total arm movement (seek time) by choosing the order of pending requests
   D. Decide which process gets the CPU next
   Answer: C. Seek time is the largest part of disk access time and the only one a scheduler can easily reduce, by ordering requests. (Key point: Aim of disk scheduling)

2. For head at 50 and queue 90, 20, 60, why is SSTF (110) better than FCFS (150)?
   A. SSTF always serves the nearest cylinder, so arm movement is smaller
   B. SSTF serves requests in arrival order
   C. SSTF reduces rotational latency instead of seek time
   D. SSTF skips the farthest request
   Answer: A. SSTF picks the nearest request each time (60, 90, 20), giving 10+30+70 = 110 against 40+70+40 = 150. (Key point: SSTF vs FCFS)

3. What is the role of device-independent I/O software?
   A. Write device-specific commands to controller registers
   B. Perform I/O functions common to all devices and give a uniform interface, leaving device details to drivers
   C. Save registers and unblock the driver on an interrupt
   D. Provide library procedures such as printf
   Answer: B. The layer sits above the drivers and handles common functions like naming, buffering and protection. (Key point: Role of device-independent layer)

4. A program calls write(fd, buf, n). What does the device-independent layer do before the driver talks to the controller?
   A. Rewrites the program for the specific device
   B. Sends the data straight to the controller registers
   C. Chooses the disk scheduling algorithm only
   D. Checks permissions, buffers the data and selects the driver
   Answer: D. The same write() works for a disk file, USB or terminal because this layer checks permission, buffers and selects the driver. (Key point: Write call example)

## Related in Operating System

- [Programmed I/O, DMA, device-independent software](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Aprogrammed-io-dma-device-independent) — Operating System, chapter 6
- [Device-independent I/O software with example](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adevice-independent-io-software-example) — Operating System, chapter 6
- [Disk scheduling: FCFS, SSF, SCAN at 53](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adisk-200-cyl-fcfs-ssf-scan-53) — Operating System, chapter 6, asked 3×
- [Disk scheduling with 100 cylinders](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adisk-100-cyl-fcfs-sstf-look-cscan-scan) — Operating System, chapter 6, asked 2×
- [Disk scheduling with 150 cylinders](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adisk-150-cyl-sstf-scan-cscan-look-fcfs) — Operating System, chapter 6, asked 2×
- [Disk scheduling, 1000 cylinders, head at 345](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adisk-1000-cyl-fifo-sstf-scan) — Operating System, chapter 6
