Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following set of processes, with the length of the CPU burst time g

ID: 3813267 • Letter: C

Question

Consider the following set of processes, with the length of the CPU burst time given in seconds The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. Use a software to draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, nonpreemptive SJF, nonpreemptive priority (a larger priority number implies a higher priority), and RR (quantum = 2), and calculate the average waiting time for each algorithm.

Explanation / Answer

Answer:

0 3 3.5 11.5 12.5 14.5

Completion time for P1 = 3 , P2 = 3.5 , P3 = 14.5 , P4 = 11.5 , P5 = 12.5

Turn Arround time = completion time - arrival time :

p1 = 3 , p2 = 2.5 , p3 = 13.5 , p4 = 9.5 , p5 = 9.5

Now waiting time = turn around time - burst time :

p1 = 0 , p2 = 1.5 , p3 = 1 , p4 = 2 , p5 = 3

Average waiting time = 0+1.5+1+2+3/5 = 7.5/5 = 1.5

0 1 3 6 11 19

Completion time :

p1 = 6, p2 = 11, p3 = 3 , p4 = 19 , p5 = 1

Turn Arround Time = completion time - arrival time :

p1 = 6, p2 = 10.5 , p3 = 1 , p4 = 17 , p5 = 2

Waiting time = turn arround time - burst time :

p1 = 3, p2 = 5.5 , p3 = -1 , p4 = 9 , p5 = -3

Average waiting time = 3+5.5+1+9-3/5 = 2.7

p3

0 3 11 13 14 19

Completion time :

p1 = 3 , p2 = 13 , p3 = 19 , p4 = 11 , p5 = 13

Turn Arround time = Completion time - Arrival Time :

p1 = 0 , p2 = 12.5 , p3 = 18 , p4 = 3 , p5 = 13

Waiting time = TAT - Burst Time :

p1 = -3 , p2 = 7.5 , p3 = 16 , p4 = -5 , p5 = 12

Average Waiting time = -3+7.5 + 16-5+12/5 = 5.5

P1 P2 P4 P5 P3