0% found this document useful (0 votes)
383 views2 pages

CS401 CPU Scheduling Exercise Problem 2 Solution FINAL

The document describes the results of CPU scheduling algorithms on a set of 5 processes with different burst times and priorities. It compares the average wait time and turnaround time of First Come First Served (FCFS), Non-Preemptive Priority, Preemptive Priority, and Round Robin scheduling. Preemptive Priority scheduling has the shortest average wait time of 9.2ms and shortest average turnaround time of 14.6ms, making it the best performing algorithm for this set of processes.

Uploaded by

Shah Sudip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
383 views2 pages

CS401 CPU Scheduling Exercise Problem 2 Solution FINAL

The document describes the results of CPU scheduling algorithms on a set of 5 processes with different burst times and priorities. It compares the average wait time and turnaround time of First Come First Served (FCFS), Non-Preemptive Priority, Preemptive Priority, and Round Robin scheduling. Preemptive Priority scheduling has the shortest average wait time of 9.2ms and shortest average turnaround time of 14.6ms, making it the best performing algorithm for this set of processes.

Uploaded by

Shah Sudip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CPU Scheduling Exercises

Problem 2
Solutions

Process  Burst  Priority Arrival Time


P1  8  4 0
P2  6  1 2
P3  1  2 2
P4  9  2 1
P5  3  3 3
 

First Come First Served
0 8 17 23 24 27
P1 P4 P2 P3 P5

Avg. Wait = 0+8‐1+17‐2+23‐2+24‐3 = 0+7+15+21+21=64/5 = 12.8 AVG TAT = 8+17‐1+23‐2+24‐2+27‐3 = 8+16+21+22+24=91/5=18.2

Non‐Preemptive Priority

0 8 14 15 24 27
P1 P2 P3 P4 P5

Avg. Wait = 8‐2+14‐2+15‐1+24‐3 = 6+12+14+21 = 53/5=10.6ms   AVG TAT = 8+14‐2+15‐2+24‐1+27‐3 = 8+12+13+23+24=80/5=16ms
Preemptive Priority

0 1 2 8 9 17 20 27
P1 P4 P2 P3 P4 P5 P1

Avg. Wait Time = 0+20‐1+2‐2+8‐2+9‐2+17‐3 = 0+19+0+6+7+14 = 46/5=9.2ms  AVG TAT = 27+8‐2+9‐2+16+20‐3 = 73/5 = 14.6ms

Round Robin (1ms Quantum)

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
P1 P4 P2 P3 P5 P1 P4 P2 P5 P1 P4 P2 P5 P1 P4 P2 P1 P4 P2 P1 P4 P2 P1 P4 P1 P4 P4

Wait Time P1 = 0+4+3+3+2+2+1+1 = 16
Wait Time P2 = 0+4+3+3+2+2+2+1 = 17
Wait Time P3 = 1
Wait Time P4 = 4+4+3+2+3+2+1 = 19
Wait Time P5 = 1+3+3 = 7
Avg Wait Time = 60/5 = 12ms

Avg TAT =25+21+2+26+10 = 84/5 = 16.8

Algorithm  Avg Wait Avg TAT


FCFS  12.2  18.2
NonP Priority  10.6  16
Prem Priority  9.6  14.6
RR  2  6.8
 

Premptive Priority has shortest wait and shortest TAT 

You might also like