Short Answer: CPU Scheduling Implement a function called com…
Short Answer: CPU Scheduling Implement a function called compute_stats (defined below) that calculates and displays the Average Waiting Time (AWT) and Average Turnaround Time (ATT) for a schedule. Example: input containing (P3, 2), (P0, 3) would display AWT: 1 and ATT: 3.5. The function takes two arguments: an array that stores a schedule (see struct below) and the number of process bursts in that schedule. Already given are two lines that display the computed results. Already included is stdio.h, do not use any other headers. Assume that the contents of the array are already sorted per some scheduling algorithm. #include struct burst { int process_id; //shouldn’t be needed int size; }; void compute_stats(struct burst schedule[], int count) { //TODO: write this code printf(“AWT: %f ATT: %f\n”, awt, att); } void main() { //example usage. do not hard code for this! struct burst processes[2]; processes[0].process_id = 3; processes[0].size = 2; processes[1].process_id = 0; processes[1].size = 3; compute_stats(processes, 2); }
Read Details