- Asked 2/13
- 2069 Bhadra · 4+6 marks
Device driver; FCFS, SSF, SCAN numerical
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).
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.
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.
User process
| read()
Device-independent I/O software
| read block n
Device driver <---- interrupt handler
| commands (registers)
Device controller -- Device
Working:
- The driver checks the request (valid parameters) and translates the abstract block number into device terms (cylinder, head, sector).
- If the device is busy, the request is queued (for a disk, a scheduling algorithm orders the queue).
- It writes the commands in the controller registers (seek, read, address, count) and blocks the calling process while the hardware works.
- When the operation is finished, the controller raises an interrupt; the interrupt handler wakes the driver.
- 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
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
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
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).
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Disk scheduling: FCFS, SSF, SCAN at 53 · Operating System, chapter 6 · asked 3×
- Disk scheduling: FCFS, SSTF, SCAN, LOOK, C-SCAN · Operating System, chapter 6
- Disk scheduling with 5000 cylinders · Operating System, chapter 6 · asked 2×
- Disk scheduling with 150 cylinders · Operating System, chapter 6 · asked 2×
- Disk scheduling with 50 cylinders · Operating System, chapter 6
- Disk scheduling with 100 cylinders · Operating System, chapter 6 · asked 2×