in Operating System
2,823 views
0 votes
0 votes
Consider following disk request sequence for a disk with 100 tracks.

44, 20,95,4,50,52,47,61,87,25

Head pointer starting at 50. Find the no. of head movements in cylinders using SCAN scheduling. Assume head moving towards cylinder 99.
in Operating System
2.8k views

2 Answers

2 votes
2 votes

SCAN Algorithm:

When a new request arrives while the drive is idle, the initial arm/head movement will be in the direction of the cylinder where the data is stored, either in or out. As additional requests arrive, requests are serviced only in the current direction of arm movement until the arm reaches the edge of the disk. When this happens, the direction of the arm reverses, and the requests that were remaining in the opposite direction are serviced, and so on.
 

50->52 = 2 
52->61 = 9
61->87 = 26
87->95 = 8
95->99 = 4
99->47 = 52
47->44 = 3
44->25 = 19
25->20 = 5
20->4 = 16
Total = 144 head movements.

Alternate:
50->99 = 49
99->4 = 95
Total = 144 head movements

Answer) 144

1 vote
1 vote

In SCAN Algorithm, the disk arm(head) starts at one end of the disk and moves toward the other end servicing requests as it reaches each cylinder it gets to the other end of the disk. At the other end direction of the head movement is reversed and servicing continues.

For the given problem, first the arm  will move towards 99 and reverses back to Zero(0) as follows:

50->52->61->87>95->99->47->44->25->20->4.

Arm movements required to go from 50 to 52 = 2

Arm movements required to go from 52 to 61 = 9

Arm movements required to go from 61 to 87 = 26

Arm movements required to go from 87 to 95 = 8

Arm movements required to go from 95 to 99 = 4

Arm movements required to go from 95 to 47 = 52

Arm movements required to go from 47 to 44 = 3

Arm movements required to go from 44 to 25 = 19

Arm movements required to go from 25 to 20 = 5

Arm movements required to go from 20 to 4 = 16

Total head movements = 2+9+26+8+4+52+3+19+5+16 = 144

edited by

3 Comments

Why not move head to 99 from 95 before reversing direction to serviceremaing cylinders as it is SCAN.
0
0

Actually the head will move till the end. But after 95 we didn't have any requests. I have already specified that. For the given problem, first the arm will move towards 99 and reverses back to Zero(0).

0
0

Sorry Rohit Kumar.  I am wrong. I changed it now. If we don't go till the end then it will become C-SCAN.

0
0

Related questions