Question: Please write in Java but if not can be done in C. Write a program that implements the following disk-scheduling algorithms: FCFS SSTF SCAN C-SCAN

Please write in Java but if not can be done in C. Write a program that implements the following disk-scheduling algorithms:

FCFS

SSTF

SCAN

C-SCAN

LOOK

C-LOOK

Your program will service a disk with n cylinders numbered 0 to n-1. The program will read a data file (input.txt). The first entry in the data file is the number of cylinders for your disk. The next entry is the cylinder number the disk position at the beginning of the simulation. Next, comes a line with a string of numbers representing the numbers of cylinders with I/O requests and service them according to each of the algorithms listed above. It will output the total amount of head movement required by each algorithm. The output should look something like the following:

For FCFS, the total head movement was xxx cylinders.

For SSTF, the total head movement was xxx cylinders.

For SCAN, the total head movement was xxx cylinders.

For C-SCAN, the total head movement was xxx cylinders.

For LOOK, the total head movement was xxx cylinders.

For C-LOOK, the total head movement was xxx cylinders.

The data in this first set is that used on pages 447 451 in your text and may be used to check your code. Then your program will read a second similar set of data from the same file and run that. Note that the data second set has different number of cylinders.

Please make extensive comments explaining as much as possible

Do any of the algorithms look especially good or bad? Data will be posted below.

* Data *

200 53 98 183 37 122 14 124 65 67 1000 250 100 400 325 290 650 222 850 250 270 150 

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 Databases Questions!