Winter Semester 2026–27 · VIT-AP · BACSE106 · Operating Systems · Dr. Krithika L.B

Session 5.2: Disk scheduling algorithms: FCFS, SSTF, SCAN, C-SCAN, LOOK, C-LOOK

Ordering the disk queue to minimise arm movement — six algorithms on the same request queue, each with a step-by-step head-movement chart.

Module 5 1.5 hours Theory CO5
← Before
5.1 Disks & RAID
Disk structure
You are here
5.2 Disk scheduling algorithms: FCFS, SSTF, SCAN, C-SCAN, LOOK, C-LOOK
Module 5 · Managing Devices, Security, Protection and Virtualization
Next →
5.3 Threats & cryptography
Security

Learning objectives

By the end of this session you should be able to:

  • Explain why the order of disk requests matters for HDDs.
  • Compute total head movement for FCFS, SSTF, SCAN, C-SCAN, LOOK and C-LOOK.
  • Identify which algorithms can cause starvation.
  • Explain why C-SCAN gives more uniform waiting times than SCAN.
  • Choose an algorithm for a given load and device.

Lecture notes

1. The problem

Requests for disk I/O arrive from many processes. When the disk is busy they wait in a queue, and the OS can choose the order in which to serve them. The goal is to minimise total head movement (seek distance), and so improve bandwidth and access time, without starving any request.

The example used everywhere

Cylinders 0–199. Request queue: 98, 183, 37, 122, 14, 124, 65, 67. The head is at 53. Every simulator below starts with this data — press Step to watch the arm move, or change the inputs.

2. FCFS

Serve requests in arrival order. Fair, but the arm swings wildly: 53 → 98 → 183 → 37 → 122 → 14 → 124 → 65 → 67 = 640 cylinders.

Simulator — FCFSEdit the inputs, press Run, then Step or Play.

3. SSTF — Shortest Seek Time First

Serve the pending request closest to the current head position: 53 → 65 → 67 → 37 → 14 → 98 → 122 → 124 → 183 = 236 cylinders. Much better, but like SJF it can starve requests far from the head if new nearby requests keep arriving — and it is not optimal (53 → 37 → 14 → 65 … gives 208).

Simulator — SSTFEdit the inputs, press Run, then Step or Play.

4. SCAN — the elevator algorithm

The arm starts at one end and moves toward the other, serving requests as it reaches each cylinder, then reverses — like a lift.

  • Head moving toward 0 (textbook): 53 → 37 → 14 → 0 → 65 → 67 → 98 → 122 → 124 → 183 = 236.
  • Head moving toward 199: 53 → 65 → … → 183 → 199 → 37 → 14 = 331.

Requests just behind the head wait almost two full sweeps; those in the middle are served more often than those at the ends.

Simulator — SCANChange Direction to compare the two cases.

5. C-SCAN — Circular SCAN

Serve requests in one direction only. When the arm reaches the end it returns immediately to the beginning without serving requests on the way back, treating the cylinders as a circular list. This gives a more uniform wait time. Moving up: 53 → 65 → 67 → 98 → 122 → 124 → 183 → 199 → 0 → 14 → 37 = 382 including the 199-cylinder return (183 if the return is not counted).

Simulator — C-SCANEdit the inputs, press Run, then Step or Play.

6. LOOK and C-LOOK

SCAN and C-SCAN travel all the way to the end of the disk even when there are no requests there. LOOK and C-LOOK go only as far as the last request in each direction, then reverse (LOOK) or jump back to the lowest pending request (C-LOOK).

  • LOOK (up): 53 → 65 → 67 → 98 → 122 → 124 → 183 → 37 → 14 = 299.
  • C-LOOK (up): 53 → … → 183 → 14 → 37 = 322 including the jump 183 → 14 (153 without it).
Simulator — LOOKEdit the inputs, press Run, then Step or Play.
Simulator — C-LOOKEdit the inputs, press Run, then Step or Play.
Say which convention you use

Textbooks differ on whether the return sweep of C-SCAN/C-LOOK counts as head movement, and on the initial direction. In exams, state your assumptions (direction, and whether the return is counted). The simulators and the lab programs count it.

7. Comparison and selection

AlgorithmTotal (example, moving up)Starvation?Notes
FCFS640NoFair, slow
SSTF236YesGood throughput, not optimal
SCAN331 (236 moving down)NoElevator; edges served less often
C-SCAN382 incl. returnNoUniform waiting time
LOOK299NoSCAN without going to the end
C-LOOK322 incl. jumpNoC-SCAN without going to the end

SSTF is common and natural; SCAN/C-SCAN (or LOOK/C-LOOK) perform better under heavy load because they cannot starve. Performance also depends on the file-allocation method (contiguous files cause less movement) and on where directories and inodes are placed. Modern drives schedule internally, and for SSDs the OS typically uses simple FCFS-like (noop/mq-deadline) schedulers.

VideoBytes

FCFS, SSTF and SCAN

Video coming soon

FCFS, SSTF and SCAN

Recorded by Dr. Krithika L.B. Slot m5-disk-sched-1

C-SCAN, LOOK and C-LOOK

Video coming soon

C-SCAN, LOOK and C-LOOK

Recorded by Dr. Krithika L.B. Slot m5-disk-sched-2

Interactive lessons

Work through these in order after the lecture — each one expands a part of the notes with diagrams, hover notes and a quick check.

Lab connection

Check your understanding

Answer each question in your own words first, then reveal the model answer.

Revealed 0
Head at 50, queue 10, 95, 35, 70. Total movement under FCFS and SSTF?

FCFS: 40 + 85 + 60 + 35 = 220. SSTF: 50 → 35 → 10 → 70 → 95 = 15 + 25 + 60 + 25 = 125.

Which algorithm is called the elevator algorithm?

SCAN.

Which algorithms can starve a request?

SSTF (and FCFS cannot; SCAN/C-SCAN/LOOK/C-LOOK cannot).

How does LOOK differ from SCAN?

LOOK reverses at the last request in the current direction instead of travelling to the end of the disk.

Why is disk scheduling less important for SSDs?

SSDs have no seek time or rotational latency; access time hardly depends on the address.

Key takeaways

  • Example (head 53): FCFS 640, SSTF 236, SCAN 331 up / 236 down, C-SCAN 382, LOOK 299, C-LOOK 322.
  • SSTF may starve; SCAN-family algorithms are starvation-free and suit heavy loads.
  • Always state direction and whether return sweeps are counted.

Where this leads

We have managed every resource — CPU, memory, files, devices. Now we must protect them, starting with the threats an OS faces and the cryptography used to defend against them.

Continue to 5.3 — Program and network threats, cryptography →