DISK SCHEDULING
ALGORITHMS
EXAMPLES
Koyel Datta Gupta
Example 1
• Work Queue: 23, 89, 132, 42, 187
• there are 200 cylinders numbered from 0 – 199
• the diskhead starts at number 100
• Previous request 95
Work Queue: 23, 89, 132, 42, 187
FCFS there are 200 cylinders numbered from 0 - 199
the diskhead starts at number 100
0 23 42 89 100 132 187 199
Total diskhead movements = |100-23|+|23-89| +|89-132|+|132-42|+|42-187| = 421
Work Queue: 23, 89, 132, 42, 187
SSTF there are 200 cylinders numbered from 0 - 199
the diskhead starts at number 100
0 23 42 89 100 132 187 199
Total diskhead movements = |100-89|+|89-132| +|132-187|+|187-42|+|42-23| = 273
Work Queue: 23, 89, 132, 42, 187
SCAN there are 200 cylinders numbered from 0 - 199
the diskhead starts at number 100
Previous request 95
0 23 42 89 100 132 187 199
Total diskhead movements = |100-132|+|132-187|+|187-199|+ |199-89| +
Work Queue: 23, 89, 132, 42, 187
C-SCAN there are 200 cylinders numbered from 0 - 199
the diskhead starts at number 100
Previous request 95
0 23 42 89 100 132 187 199
Total diskhead movements = |100-132|+|132-187|+|187-199|+ |199-0| +|0-23|+
Work Queue: 23, 89, 132, 42, 187
LOOK there are 200 cylinders numbered from 0 - 199
the diskhead starts at number 100
Previous request 95
0 23 42 89 100 132 187 199
Total diskhead movements = |100-132|+|132-187|+|187-89|+ |89-42|+|42-23| =251
Work Queue: 23, 89, 132, 42, 187
C-LOOK there are 200 cylinders numbered from 0 - 199
the diskhead starts at number 100
Previous request 95
0 23 42 89 100 132 187 199
Total diskhead movements = |100-132|+|132-187|+|187-23|+ |23-42|+|42-89| = 317
Example 2
• Suppose a disk has 201 cylinders, numbered from 0 to 200. At some time the
disk arm is at cylinder 100, and there is a queue of disk access requests for
cylinders 30, 85, 90, 100, 105, 110, 135 and 145. If Shortest-Seek Time First
(SSTF) is being used for scheduling the disk access, the request for cylinder
90 is serviced after servicing ____________ number of requests.
(A) 1 (B) 2 (C) 3 (D) 4
• In Shortest-Seek-First algorithm, request closest to the current position of the
disk arm and head is handled first.
• In this question, the arm is currently at cylinder number 100. Now the
requests come in the queue order for cylinder numbers 30, 85, 90, 100, 105,
110, 135 and 145.
• The disk will service that request first whose cylinder number is closest to its
arm. Hence 1st serviced request is for cylinder no 100 ( as the arm is itself
pointing to it ), then 105, then 110, and then the arm comes to service request
for cylinder 90. Hence before servicing request for cylinder 90, the disk would
had serviced 3 requests.
Example 3
• Consider a typical disk that rotates at 15000 rotations per minute
(RPM) and has a transfer rate of 50 × 106 bytes/sec. If the average
seek time of the disk is twice the average rotational delay and the
controller’s transfer time is 10 times the disk transfer time, the
average time (in milliseconds) to read or write a 512 byte sector of
the disk is ______________
• Disk latency = Seek Time + Rotation Time + Transfer Time +
Controller Overhead
• Seek Time - Depends no. tracks the arm moves and seek speed of
disk
• Rotation Time- depends on rotational speed and how far the sector
is from the head
• Transfer Time- depends on data rate (bandwidth) of disk (bit
density) and the size of request
Example 3 contd..
• Average Rotational Time = (0.5)/(15000 / 60) = 2 miliseconds
[On average half rotation is made]
• It is given that the average seek time is twice the average
rotational delay
• So Avg. Seek Time = 2 * 2 = 4 miliseconds.
• Transfer Time = 512 / (50 × 106 bytes/sec) = 10.24
microseconds
• Given that controller time is 10 times the average transfer time
Controller Overhead = 10 * 10.24 microseconds = 0.1
miliseconds
• Disk latency = Seek Time + Rotation Time + Transfer Time +
Controller Overhead = 4 + 2 + 10.24 * 10-3 + 0.1 miliseconds =
6.1 miliseconds