# Calculating disk seek times

I have a system where disk requests come to a disk drive for cylinders in the order 10, 22, 20, 2, 40, and 38 at a time when the disk drive is reading from cylinder 20. The seek time is 6ms per cylinder. I have to find total seek time if the disk scheduling algorithm is First-Come-First-Serve (FCFS).

To find the answer I used a formula:

total seek time=0.254*sqrt(d)(for each cylinder and sum them)

But that gave the incorrect result. What formula(s) should I be using to handle questions like this?

@tonny, I am also found this example from a book, I think the number 6 is missed after the number 40 in the example. The correct order is 10, 22, 20, 2, 40, 6 and 38. So if it starts from cylinder 20, You can write it as, -> (20), 10, 22, 2, 40, 6, 38 -> (20-10)+(10-22)+(22-2)+(2-40)+(40-6)+(6-38) -> 10+12+20+38+34+32 -> 146. So seek time is = 146*6 876 ms.

• Thanks for clearing up the missing value from the question. It would probably be useful to state which book this is. – David Richerby Feb 10 '16 at 15:58

You state that the seek time is 6ms per cylinder. That means: take the distance (in cylinders) that you move and multiply it by 6ms.

You are starting on cylinder 20, then moving to cylinder 10: that is 20-10=10 cylinders difference, so 6ms*10 = 60ms. Then you move from cylinder 10 to cylinder 22: that is 22-10=12 cylinders difference, so another 6ms*12 = 72ms. And so on.

• my book has direct solution which says: the disk drive has to traverse totally 146 cylinders and then 146*6=876 ms.but how 146 ? – tonny Oct 18 '14 at 16:33
• @tonny. I can think of three reasons. (1) The book's solution is wrong, (2) you miscopied the problem, or (3) the book is using some nonstandard version of FCFS. – Rick Decker Oct 18 '14 at 17:48
• Moving the suggested way gives 492 ...is it right then? @RickDecker – tonny Oct 18 '14 at 18:19
• out of the three reasons only 1 or 3 may be valid – tonny Oct 18 '14 at 18:20
• @tonny. I'd agree with 492 as an answer. You'd almost get the book's answer if you added all the cylinder numbers. If I had to guess, I'd say that the answer was wrong. I know from much experience that answering questions, even ones that I made up, is fraught with errors. – Rick Decker Oct 18 '14 at 18:29