# Disk scheduling algorithm - SCAN and C-SCAN

I'm studying several disk scheduling algorithms; however, I'm kinda confused with SCAN. I understand the concept, but I don't understand the example given in the book. I think that the author made a mistake, but I want to be sure.

The example is the following:

Description of SCAN: The disk arm starts at one end of the disk, and moves toward the other end, servicing requests until it gets to the other end of the disk, where the head movement is reversed and servicing continues.

Suppose that the cylinder range goes from 0 to 199 and you have the following queue:
98, 183, 37, 122, 14, 124, 65, 67

As seen in the image, the total head movement is of 208 cylinders

I don't understand why 208 cylinders. If I understand correctly, the head will start at 53 and then move to 0 (that's 53 cylinders), then the head will move up and the last service requested is at 183 (that's another 183 cylinders). So the total head movement should be 53 + 183 = 236.

The book also has an image and description of C-SCAN:

C-SCAN moves the head from one end of the disk to the other, servicing requests along the way. When the head reaches the other end, however, it immediately returns to the beginning of the disk without servicing any requests on the return trip. The C-SCAN scheduling algorithm essentially treats the cylinders as a circular list that wraps around from the ﬁnal cylinder to the ﬁrst one.

Using the same example, with C-SCAN the cylinder would start at 53, then move up to 199 (146 cylinder movements), then go to 0 (199 movements), and then the last request would be at 37 (37 cylinder movements). The total cylinder movements would be 146+199+37=382. My question here is, do we also have to count the cylinders when the head goes back to 0 since it isn't servicing any requests?

Note: This information was extracted from Operating System Concepts with Java - 8th Edition by Silberschatz, Galvin, Gagne. You can also find this part of the chapter here.

• The difference between 208 and 236 is 28, which amounts to twice the path 0-14. I guess the text assumed that after servicing 14, the head would not have gone down to 0, but reversed its direction instead since there was nothing in the queue for 0-14.
– chi
Jun 3 '17 at 13:23
• @chi Yeah, but I think that would be the C-LOOK algorithm. C-LOOK definition: Arm only goes as far as the last request in each direction, then reverses direction immediately, without first going all the way to the end of the disk.
– Jack
Jun 6 '17 at 9:07