100% found this document useful (2 votes)
2K views

Cs 604 Assignment No 2 Solution

The document provides solutions for scheduling algorithms: 1) Non-preemptive SJF is modeled with a Gantt chart showing process completion times and calculations of waiting times and average waiting time of 5. 2) Preemptive SJF is modeled with a Gantt chart and calculations showing an average waiting time of 4.5. 3) It is concluded that preemptive SJF performs better with a lower average waiting time.

Uploaded by

Shan Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
2K views

Cs 604 Assignment No 2 Solution

The document provides solutions for scheduling algorithms: 1) Non-preemptive SJF is modeled with a Gantt chart showing process completion times and calculations of waiting times and average waiting time of 5. 2) Preemptive SJF is modeled with a Gantt chart and calculations showing an average waiting time of 4.5. 3) It is concluded that preemptive SJF performs better with a lower average waiting time.

Uploaded by

Shan Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like