Vous êtes sur la page 1sur 3

Cs 604 Assignment No 2 Solution

Solution

A) You are required to provide the Gantt chart for non-preemptive SJF
(Shortest Job First) scheduling algorithm. Calculate the waiting time for
each process and average waiting time.

P1 P4 P3 P2

0 9 11 14 20

Processes Arrival time CPU Brust Completion time Turn around time Waiting time
P1 0 9 9 9 0
P2 3 6 20 17 11
P3 5 3 14 9 6
P4 6 2 11 5 3

Average Waiting time= 0+11+6+3/4

= 20/4

= 5 is average waiting time

b) You are required to provide the Gantt chart for preemptive SJF (Shortest
Job First) or STRF (Shortest Remaining Time First) scheduling algorithm.
Calculate the waiting time for each process and average waiting time.

Answer

P1 P3 P4 P1 P2

0 5 8 10 14 20

Visit www.infopalaces.blogspot.com
Processes Arrival time CPU Brust Completion time Turn around time Waiting time
P1 0 9 14 14 5
P2 3 6 20 17 11
P3 5 3 8 3 0
P4 6 2 10 4 2

Average waiting time = 5+11+0+2/4

= 18/4

= 4.5 is average waiting time

c) From the above calculations, you have to mention the name of


scheduling algorithm which performs better in term of average waiting
time.

Answer

From the above calculations it is proved that preemptive sjf is better in term
of avgerage waiting time

NOTE: IF YOU FOUND ANY MISTAKE THEN CORRECT IT PLEASE DON’T MAKE EXACT
COPY OF THIS SOLUTION, MAKE CHANGES TO AVOID ZERO MARKING. IM NOT
RESPONSIBLE FOR IT.
Visit www.infopalaces.blogspot.com
For others assignments solution please
visitwww.infopalaces.blogspot.com

Visit www.infopalaces.blogspot.com

Vous aimerez peut-être aussi