$30
Assignment 7
1 Description
This assignment is to develop a simulation of FCFS and C-SCAN disk scheduling
algorithms.
2 Task
You are to simulate two disk scheduling algorithms servicing requests to HDD.
The algorithms to implement:
FCFS (F)
C-SCAN (C)
Your simulated disk is of size 10000, numbered from 0 to 9999. A series of sector
requests are read from stdin and service them in accordance with the algorithm
specified from command line parameter (”C” for C-SCAN, and ”F” for FCFS)
3 Input format
1 123 15
The first number is the sector to service, the second number is the time that
the request arrives. The input times are sorted by request arrival in increasing
order. The program always begins with the head fixed at sector zero, head
moving in ascending order.
The requests can only be serviced after they arrive. The simulation begins
at time 0. The time (unsigned int) required to process a request is computed by
distance the head travels divided by 5, plus additional 15 miliseconds penalty if
the direction has to change (for FCFS).
1
The decision for which sector(s) to service next is made after the current
sector is serviced to completion. In summary, report the distance traveled and
the time the simulation is complete.
Sample program execution
1 ./ a . out C < sample_test . txt
For the exact input and output format please refer to the sample input.txt and
sample output.txt.
4 Submission instructions
Please submit just your C and H files (if any) to D2L Assignment box. Make
sure your code compiles and runs. Make sure your code follows the specified
input/output format. You must use C programming language to solve this
assignment.
NOTE: THE INPUT AND OUTPUT OF YOUR
PROGRAM IS SPECIFIED SUCH THAT THE
MARKER CAN AUTO TEST YOUR SUBMISSIONS.
2