Question: This assignment is somewhat similar to the CPU scheduling assignment, excepting that it doesn't use threads, so it should be much easier to complete. Write

This assignment is somewhat similar to the CPU scheduling assignment, excepting that it doesn't use threads, so it should be much easier to complete. Write a program to simulate the application of different disk scheduling algorithms to a common input reference string. The algorithms to be simulated are SSTF, FCFS, and LOOK.Program Input and OutputYour program should take its input from a file, "input.txt". The first line of the file will contain a single integer, equal to the number of tracks on the simulated disk. You should assume the head starts over track 0. The remainder of the file will consist of a sequence of entries separated by linefeeds. Each entry represents the submission of a track request to the scheduler. The entries are of the form:s tWhere s and t are both positive integers ands is the number of milliseconds elapsed since the submission of the previous request and t is the track number requested. Keep in mind that requests will be received as other requests are being serviced.Your program should generate a table that, for each type of scheduler, prints the order in which each algorithm services the requests, the time of each service, which track is being served, and the total elapsed simulated time to service all requests. You should assume that the simulated disk head starts over track 0 at the start of the simulation. Rather than measuring time directly, you should merely assume that it takes 1 millisecond to traverse each track. Thus to move the head from track 30 to track 67 would require 37 milliseconds of simulated time.Here is some sample input
200
053
1598
15183
1537
15122
1514
15124
1565
1567
1550
1596
15181
1535
15121
1517
15129
1528
1573
Example Output========================================================FCFS========================================================[Time=0] Adding request 53. Head @ 0. Current target =53 Pending requests are now [53][Time=15] Adding request 98. Head @ 15. Current target =53 Pending requests are now [53,98][Time=30] Adding request 183. Head @ 30. Current target =53 Pending requests are now [53,98,183][Time=45] Adding request 37. Head @ 45. Current target =53 Pending requests are now [53,98,183,37][Time=53]>>>>SERVICING track 53.[Time=60] Adding request 122. Head @ 60. Current target =98 Pending requests are now [98,183,37,122][Time=75] Adding request 14. Head @ 75. Current target =98 Pending requests are now [98,183,37,122,14][Time=90] Adding request 124. Head @ 90. Current target =98 Pending requests are now [98,183,37,122,14,124][Time=98]>>>>SERVICING track 98.[Time=105] Adding request 65. Head @ 105. Current target =183 Pending requests are now [183,37,122,14,124,65][Time=120] Adding request 67. Head @ 120. Current target =183 Pending requests are now [183,37,122,14,124,65,67][Time=135] Adding request 50. Head @ 135. Current target =183 Pending requests are now [183,37,122,14,124,65,67,50][Time=150] Adding request 96. Head @ 150. Current target =183 Pending requests are now [183,37,122,14,124,65,67,50,96][Time=165] Adding request 181. Head @ 165. Current target =183 Pending requests are now [183,37,122,14,124,65,67,50,96,181][Time=180] Adding request 35. Head @ 180. Current target =183 Pending requests are now [183,37,122,14,124,65,67,50,96,181,35][Time=183]>>>>SERVICING track 183.[Time=195] Adding request 121. Head @ 171. Current target =37 Pending requests are now [37,122,14,124,65,67,50,96,181,35,121][Time=210] Adding request 17. Head @ 156. Current target =37 Pending requests are now [37,122,14,124,65,67,50,96,181,35,121,17][Time=225] Adding request 129. Head @ 141. Current target =37 Pending requests are now [37,122,14,124,65,67,50,96,181,35,121,17,129][Time=240] Adding request 28. Head @ 126. Current target =37 Pending requests are now [37,122,14,124,65,67,50,96,181,35,121,17,129,28][Time=255] Adding request 73. Head @ 111. Current target =37 Pending requests are now [37,122,14,124,65,67,50,96,181,35,121,17,129,28,73][Time=329]>>>>SERVICING track 37.[Time=414]>>>>SERVICING track 122.[Time=522]>>>>SERVICING track 14.[Time=632]>>>>SERVICING track 124.[Time=691]>>>>SERVICING track 65.[Time=693]>>>>SERVICING track 67.[Time=710]>>>>SERVICING track 50.[Time=756]>>>>SERVICING track 96.[Time=841]>>>>SERVICING track 181.[Time=987]>>>>SERVICING track 35.[Time=1073]>>>>SERVICING track 121.[Time=1177]>>>>SERVICING track 17.[Time=1289]>>>>SERVICING track 129.[Time=1390]>>>>SERVICING track 28.[Time=1435]>>>>SERVICING track 73.FCFSTotal Run-Time: 1435Servicing Sequence was: [0,53,98,183,37,122,14,124,65,67,50,96,181,35,121,17,129,28,73]=========================

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!