---
title: "Structured I/O software; SCAN vs SSTF"
subject: "Operating System"
chapter: 6
key: "semester_6/operating_system:structured-io-software-scan-vs-sstf"
source: https://www.bctengineer.com/q/semester_6/operating_system/structured-io-software-scan-vs-sstf
site: BCT Engineering
---

# Structured I/O software; SCAN vs SSTF

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

- Asked in: 2073 Bhadra, 6 marks; year not given
- Video: [L-6.5: SSTF in Disk scheduling with Example | Operating System](https://www.youtube.com/watch?v=P_dA8VGJjA8) — Gate Smashers
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/structured-io-software-scan-vs-sstf
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-6

## Question

Briefly mention the structured I/O software with suitable diagram. Compare the throughput (overall performance) of SCAN with SSTF.

## Short answer

I/O software is layered: interrupt handlers, device drivers, device-independent software, and user-level I/O software. SSTF gives higher throughput under light load by choosing the nearest request, but can starve requests; SCAN has slightly lower average throughput but no starvation and steady response under heavy load. For the sample queue both gave 236 cylinders.

## Answer

#### Structured I/O software
I/O software is organised in four layers, so that each layer does one job and hides details from the layer above (Tanenbaum).

```text
 User process (read, write, printf)
          |
 +-----------------------------+
 | User-level I/O software     |  libraries, spooling
 +-----------------------------+
 | Device-independent OS soft. |  naming, buffering,
 |                             |  protection, uniform I/F
 +-----------------------------+
 | Device drivers              |  device specific code
 +-----------------------------+
 | Interrupt handlers          |  wake blocked driver
 +-----------------------------+
          |
       Hardware
```

1. **Interrupt handlers:** save registers, service the interrupt, unblock the waiting driver, then return. They are kept short and hidden deep in the OS.
2. **Device drivers:** device-specific code that issues commands to the controller registers, and blocks until the interrupt arrives. One driver per device type.
3. **Device-independent software:** uniform interface to drivers, naming, protection, buffering, error reporting, allocating dedicated devices, device-independent block size.
4. **User-space I/O software:** library procedures (e.g. `printf`) and spooling systems (print spooler).

#### SCAN vs SSTF (throughput)
| Point | SSTF | SCAN (elevator) |
|---|---|---|
| Selection | Nearest request | Request in current sweep direction |
| Throughput | High under light/moderate load | Slightly lower on average, but good and steady under heavy load |
| Average seek | Usually lowest | A little higher (goes to the end of the disk) |
| Starvation | Possible for far requests | None; every request is served within one sweep |
| Response time variance | High | Low |
| Bias | Favours the central region | Favours middle cylinders mildly, but bounded wait |

For the queue 98, 183, 37, 122, 14, 124, 65, 67 with head at 53, SSTF gives 236 and SCAN (moving towards 0) also gives 236, but SCAN is preferred when load is heavy, as SSTF can starve requests and has unpredictable delay.

**Conclusion:** SSTF gives slightly better raw throughput for light load, whereas SCAN gives nearly the same throughput with fairness and predictable response time.

## Check yourself

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

1. What is the correct order of I/O software layers from top to bottom?
   A. User-level, device-independent, device drivers, interrupt handlers
   B. Interrupt handlers, drivers, device-independent, user-level
   C. Device drivers, user-level, interrupt handlers, device-independent
   D. User-level, device drivers, device-independent, interrupt handlers
   Answer: A. Requests travel down from user-level software to the hardware, with interrupt handlers lowest. (Key point: Layer order)

2. What does an interrupt handler do?
   A. Issues commands to the controller registers
   B. Saves registers, services the interrupt and unblocks the waiting driver
   C. Provides buffering and naming
   D. Implements spooling
   Answer: B. Interrupt handlers are short and wake the blocked driver; drivers issue the device commands. (Key point: Interrupt handler job)

3. Which statement about starvation is correct?
   A. SCAN can starve far requests, SSTF cannot
   B. Both can starve requests equally
   C. Neither can starve requests
   D. SSTF can starve far requests, SCAN cannot because every request is served within a sweep
   Answer: D. SCAN's sweep bounds the wait, while SSTF may keep favouring nearby requests. (Key point: Starvation comparison)

4. When is SCAN preferred over SSTF?
   A. Under light load, for lowest seek
   B. When the disk has only one request
   C. Under heavy load, for fairness and predictable response time
   D. When the head must go only upward
   Answer: C. SCAN gives nearly the same throughput with low response variance, so it suits heavy load. (Key point: When SCAN preferred)

## Related in Operating System

- [Structured I/O software with diagram](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Astructured-io-software-diagram) — Operating System, chapter 6
- [Interleaving; SSTF, SCAN, C-SCAN order](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Ainterleaving-winchester-disk-scheduling) — Operating System, chapter 6
- [Disk scheduling: FCFS, SSTF, SCAN, LOOK, C-SCAN](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adisk-200-cyl-head-moving-60) — Operating System, chapter 6

## Related in other subjects

- [Compare Z-buffer, A-buffer; scan-line](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Acompare-z-a-buffer-scan-line) — Computer Graphics, chapter 7
- [Compare software models; propose a fourth model](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Asw-models-compare-fourth) — Instrumentation II, chapter 9
- [Structured vs unstructured, NoSQL taxonomy](https://www.bctengineer.com/question.md?key=semester_8%2Fbig_data_technologies%3Astructured-unstructured-nosql-taxonomy) — Big Data Technologies, chapter 4
- [Why system modeling; weakness of structured analysis](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Asystem-modeling-importance) — Software Engineering, chapter 2
