Write a linux program that implements the c-scan disk scheduling algorithms. we
ID: 3762936 • Letter: W
Question
Write a linux program that implements the c-scan disk scheduling algorithms. we assume that the disk arm moves upwards(towards the edge) initially.
The program takes two inputs
- the starting position
- a disk request file
the program generates two outputs
- The schedule sequence
- The total disk seek distance
disk request file
test
assume your program is called iosched
1. to run the program
$iosched 2000 disk-reqeust-file
2069,2296,....
total disk seek distance is nnnnn
Explanation / Answer
#include #include #include #include using namespace std; int compare (const void * a, const void * b) { if ( *(int*)a < *(int*)b ) return -1; if ( *(int*)a == *(int*)b ) return 0; if ( *(int*)a > *(int*)b ) return 1; } void shift(int a[],const int size) { for(int i=1;i100) goto enter_request_number; current_location: coutrequest[0]; sorted_request[0]=request[0]; if(request[0]>max||request[0]Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.