---
title: "Device driver; FCFS, SSF, SCAN numerical"
subject: "Operating System"
chapter: 6
key: "semester_6/operating_system:device-driver-disk-fcfs-ssf-scan"
source: https://www.bctengineer.com/q/semester_6/operating_system/device-driver-disk-fcfs-ssf-scan
site: BCT Engineering
---

# Device driver; FCFS, SSF, SCAN numerical

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

- Asked in: 2069 Bhadra, 4+6 marks
- Video: [FCFS SSTF SCAN CSCAN LOOK CLOOK Solved Example in Hindi | Disk Scheduling Sums | OS Lectures](https://www.youtube.com/watch?v=dEt7mr9R_Z8) — Last moment tuitions
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/device-driver-disk-fcfs-ssf-scan
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-6

## Question

Explain working mechanism of device driver. Suppose a disk drive with 200 cylinders, numbered from 0 to 199. The drive is currently serving a request at cylinder 53. The queue of pending requests is: 98, 183, 37, 122, 14, 124, 65, 67. Starting from the current head position, calculate total distances (in cylinders) that the disk arm moves to satisfy all pending requests for FCFS, SSF and SCAN disk scheduling algorithms.

## Short answer

A device driver translates abstract I/O requests into device-specific commands, queues requests, programs controller registers, blocks the process, and handles interrupts. For the disk: FCFS total head movement = 640 cylinders, SSTF = 236 cylinders, SCAN = 331 cylinders (236 if initially moving toward cylinder 0).

## Answer

#### Working mechanism of a device driver
A **device driver** is the device-specific software (usually in the kernel) that knows how to talk to one type of device controller. It accepts abstract requests from the device-independent software above it ("read block n") and issues the commands to the controller registers.

```text
 User process
     | read()
 Device-independent I/O software
     | read block n
 Device driver  <---- interrupt handler
     | commands (registers)
 Device controller -- Device
```
Working:
1. The driver checks the request (valid parameters) and translates the abstract block number into device terms (cylinder, head, sector).
2. If the device is busy, the request is queued (for a disk, a scheduling algorithm orders the queue).
3. It writes the commands in the controller registers (seek, read, address, count) and **blocks** the calling process while the hardware works.
4. When the operation is finished, the controller raises an **interrupt**; the interrupt handler wakes the driver.
5. The driver checks for errors, passes data/status back and starts the next queued request.
It also handles power management, initialisation and re-entrancy; drivers are loaded as modules.

#### Disk scheduling numerical
200 cylinders (0 to 199), head at 53, queue: 98, 183, 37, 122, 14, 124, 65, 67. The direction is not stated, so the head is taken as moving towards higher cylinder numbers for SCAN.

**FCFS**: service order (head at 53): 98, 183, 37, 122, 14, 124, 65, 67
```text
   53 -> 98    = 45
   98 -> 183   = 85
  183 -> 37    = 146
   37 -> 122   = 85
  122 -> 14    = 108
   14 -> 124   = 110
  124 -> 65    = 59
   65 -> 67    = 2
Total = 45 + 85 + 146 + 85 + 108 + 110 + 59 + 2 = 640
```

**SSTF**: service order (head at 53): 65, 67, 37, 14, 98, 122, 124, 183
```text
   53 -> 65    = 12
   65 -> 67    = 2
   67 -> 37    = 30
   37 -> 14    = 23
   14 -> 98    = 84
   98 -> 122   = 24
  122 -> 124   = 2
  124 -> 183   = 59
Total = 12 + 2 + 30 + 23 + 84 + 24 + 2 + 59 = 236
```

**SCAN**: service order (head at 53): 65, 67, 98, 122, 124, 183, 37, 14
```text
   53 -> 65    = 12
   65 -> 67    = 2
   67 -> 98    = 31
   98 -> 122   = 24
  122 -> 124   = 2
  124 -> 183   = 59
  183 -> 199   = 16
  199 -> 37    = 162
   37 -> 14    = 23
Total = 12 + 2 + 31 + 24 + 2 + 59 + 16 + 162 + 23 = 331
```


| Algorithm | Total head movement |
|---|---|
| FCFS | 640 cylinders |
| SSF (SSTF) | 236 cylinders |
| SCAN (upward first) | 331 cylinders |

If SCAN moves towards 0 first: 53 -> 37 -> 14 -> 0 (53 cylinders) then 0 -> 183 (183 cylinders) = 236 cylinders.

**Answer: FCFS = 640, SSF = 236, SCAN = 331 cylinders (236 if the arm initially moves toward cylinder 0).**

## Check yourself

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

1. After a driver writes commands into controller registers, what happens?
   A. The driver polls forever with the CPU
   B. The calling process blocks until the controller raises an interrupt
   C. The process continues without waiting
   D. The kernel reboots the device
   Answer: B. The interrupt handler wakes the driver, which checks errors and starts the next request. (Key point: Driver working)

2. FCFS total head movement from 53 for 98,183,37,122,14,124,65,67 is:
   A. 236
   B. 331
   C. 640
   D. 559
   Answer: C. 45+85+146+85+108+110+59+2 = 640. (Key point: FCFS total)

3. SSTF from 53 serves the requests in which order?
   A. 37, 14, 65, 67, 98, 122, 124, 183
   B. 98, 122, 124, 183, 65, 67, 37, 14
   C. 65, 67, 98, 122, 124, 183, 37, 14
   D. 65, 67, 37, 14, 98, 122, 124, 183
   Answer: D. Each step picks the closest pending cylinder; total is 236. (Key point: SSTF order)

4. SCAN moving upward from 53 to 199 then reversing gives total movement:
   A. 331
   B. 236
   C. 299
   D. 640
   Answer: A. 146 up to 199, then 162 down to 37 and 23 to 14: 146+16... total 331. (Key point: SCAN total)

## Close variants set in other exams

- [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×

## Related in Operating System

- [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
- [Disk scheduling with 5000 cylinders](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adisk-5000-cyl-fcfs-scan-look-cscan-sstf) — 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 with 50 cylinders](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adisk-50-cyl-fcfs-sstf-scan-look-cscan) — Operating System, chapter 6
- [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×
