CAP366 · Unit 8: Protection and disk management
Disk structure and disk scheduling (FCFS, SSTF, SCAN, C-SCAN)
20 practice questions · in the ETE syllabus
Key points
- Access time = seek + rotational latency + transfer
- SSTF can cause starvation
- SCAN goes to the disk end; LOOK stops at the last request
- C-SCAN gives more uniform waiting
- ext4 uses inodes and extents; NTFS uses the MFT
- Both journal metadata for fast crash recovery
- Real schedulers work on LBAs; drives reorder with NCQ
A disk consists of platters with tracks; the same track on all platters forms a cylinder. Access time = seek time (moving the head to the cylinder) + rotational latency (waiting for the sector to rotate under the head) + transfer time. Scheduling mainly reduces seek time.
| Policy | Rule | Notes |
|---|---|---|
| FCFS | Serve in arrival order | Fair but long movement |
| SSTF | Nearest cylinder first | Can starve far requests |
| SCAN | Sweep to one end, then reverse | Elevator algorithm |
| C-SCAN | Sweep one way, jump back to start | More uniform waits |
| LOOK / C-LOOK | Turn at the last request, not the disk end | Less movement |
Worked example: head at 53, queue 98, 183, 37, 122, 14, 124, 65, 67, cylinders 0-199: FCFS travels 640 cylinders, SSTF 236 (order 65, 67, 37, 14, 98, 122, 124, 183), SCAN going toward 0 first also 236, C-SCAN going up and counting the return jump 382, and LOOK going up 299.
Exam trap: state whether the return trip of C-SCAN is counted; and SCAN goes to the physical end of the disk, whereas LOOK stops at the last request.
Case study: disk management in Windows and Linux
File systems. Linux commonly uses ext4, Windows uses NTFS.
| ext4 (Linux) | NTFS (Windows) | |
|---|---|---|
| File metadata | One inode per file, in block groups | At least one record per file in the Master File Table (MFT) |
| Where data lives | Extents: runs of contiguous blocks (start, length) instead of indirect block maps | Runs of clusters; a very small file can be stored resident inside its MFT record |
| Directories | Hashed tree index for large directories | B+ tree index |
| Crash recovery | Journal; the default mode journals metadata only | Log file of metadata transactions, replayed after a crash |
| Protection | Owner, group, other rwx bits, plus optional ACLs | Access control lists in security descriptors |
| Naming | One tree; disks are mounted at directories | Volumes get drive letters (or are mounted in folders) |
Journaling means a crash leaves the file system structure consistent after a short log replay instead of a full scan; user data written just before the crash can still be lost.
Disk scheduling in practice. Drives present a linear range of logical block addresses (LBA) and hide their real geometry, so the OS orders requests by block number, which roughly matches cylinder order. Drives also reorder their own queue (Native Command Queuing) using the head position and rotation. Linux offers a choice of I/O scheduler per device in /sys/block/<dev>/queue/scheduler (for example mq-deadline, BFQ or none). Windows does not expose SCAN-style policies; it tags requests with I/O priorities and leaves fine reordering to the driver and the drive. On SSDs there is no seek, so ordering matters little; both systems send TRIM so the SSD knows which blocks are free (fstrim on Linux, Optimize Drives on Windows).
Exam point: FCFS, SSTF, SCAN and C-SCAN are the model; real systems combine a simple OS policy with reordering inside the drive.
Try two questions
How does C-SCAN differ from SCAN?
- It returns from one end to the start without serving requests, giving more uniform waits
- It serves requests while sweeping in both directions, giving equal waits to every cylinder
- It always serves the nearest pending request first, wherever the head is
- It reverses direction at the last request in the queue, not at the disk end
Show the answer
A. C-SCAN treats the cylinders as circular, serving in one direction only.
Why not B: Serving in both directions is SCAN.
Why not C: That is SSTF.
Why not D: That is the LOOK variant.
With the same queue (head at 53; 98, 183, 37, 122, 14, 124, 65, 67; cylinders 0 to 199), SCAN, initially moving toward cylinder 0 and going to the end, travels how many cylinders?
- 183 cylinders
- 331 cylinders
- 299 cylinders
- 236 cylinders
Show the answer
D. The head goes 53 down to 0 (53) and then up to 183 (183), giving 236.
Why not A: 183 is the distance from 0 to the farthest request only.
Why not B: 331 is SCAN moving up first.
Why not C: 299 is LOOK moving up first.