In: Computer Science
Task 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Consider a disk drive with 2,000 tracks, numbered 0 to 1,999. The request queue has
the following composition: 1045 750 932 878 1365 1787 1245 664 1678 1897
The current position is 1167 and the previous request was served at 1250. For each
of the following disk scheduling algorithms, compute the total distance (in tracks)
that the disk arm would move. Explain how you arrive at your answers.
4.1 First-In-First-Out (FIFO) (2)
4.2 Shortest-Service-Time-First (SSTF) (2)
4.3 SCAN (Without LOOK variation) (2)
4.4 C-SCAN (Without C-LOOK variation) (2)
4.1)
FIFO -
Current position is 1167
In FIFO, the requests will be served in order that is 1045 750 932 878 1365 1787 1245 664 1678 1897
Number of movements -
1167 -> 1045 - 122
1045 -> 750 - 295
750 -> 932 - 182
932 -> 878 - 54
878 -> 1365 - 487
1365 -> 1787 - 422
1787 -> 1245 - 542
1245 -> 664 - 581
664 -> 1678 - 1014
1678 -> 1897 - 219
Now take sum of all these results
4.2)
SSTF - This algorithm services that request next which requires least number of head movements from its current position
Hence requests will be served in following order -
1167 -> 1245 -> 1365 -> 1678 -> 1787 -> 1897 -> 1045 -> 932 -> 878 -> 750 -> 664
I hope you can perform addition by yourself
4.3)
SCAN - Head starts from one end of the disk and move towards the other end servicing all the requests in between.After reaching the other end, head reverses its direction and move towards the starting end servicing all the requests in between.
Hence requests will be served in following order -
1167 -> 1245 -> 1365 -> 1678 -> 1787 -> 1897 -> 1045 -> 932 -> 878 -> 750 -> 664
I hope you can perform addition by yourself
4.4)
C - SCAN - Head starts from one end of the disk and move towards the other end servicing all the requests in between.After reaching the other end, head reverses its direction.It then returns to the starting end(that is 0) without servicing any request in between.The same process repeats.
Hence requests will be served in following order -
1167 -> 1245 -> 1365 -> 1678 -> 1787 -> 1897 -> 664 -> 750 -> 878 -> 932 -> 1045
I hope you can perform addition by yourself
I have tried to explain it in very simple language and I hope that i have answered your question satisfactorily.Leave doubts in comment section if any.