You are on page 1of 14

FCFS

p1 p2 p3 p4 p5
0 1 3 7
0 2 3 11 15 20

4 contex
switching
SJF

p2 p1 p4 p5 p3
0 1 3 7
0 1 3 7 12 20

4 contex
switching
Nonpreemptive priority

p3 p5 p1 p4 p2
0 1 3 7
0 8 13 15 19 20

4 contex
switching
RR (quantum=2)

p1 p2 p3 p4 p5 p3 p4 p5 p3 p5 p3
00 2 3 5 7 9 711 13 15 17 18 20

10 contex switch
By using this formula to find t.a.t and w.t
Turn around time=complition time-arrival time;
waiting time=TAT-burst time

fcfs sjf nonpree Rr(quant fcfs sjf Non RR(2)


mptive um=2) Preem
ptive
Wating Wating Wating Wating turnar turnar Turna
time time time time ound ound round
time time time T.R.T
p1 0 1 13 0 2 3 15 2
p2 2 0 19 2 3 1 20 3
p3 3 12 0 12 11 20 8 20
p4 11 3 15 9 15 7 19 13
P5 15 7 8 13 20 12 13 18
Solution (d)

Ans c>
Average Waiting time of fcfs=(0+2+3+11+15)/5=6.2;
Average Waiting time of
sjf=(1+0+12+3+7)/5=4.6;
Average Waiting time of nonpreemptive=
=(13+19+0+15+8)/5=11;
Average Waiting time of
RR(quantum=2)=0+2+21+11+18/5=10.4;
SJF RESULT IN THE MINIMUM WAITING TIME.
PART 2
FCFS

p1 p2 p3 p4 p5
0 1 3 7
0 2 3 11 15 20

4 contex
switching
SJF (preemptive)

p1 p2 p4 p5 p3
0 1 3 7
0 2 3 7 12 20

4 contex
switching
SJF (non-preemptive)

p1 p2 p4 p5 p3
0 1 3 7
0 2 3 7 12 20

4 contex
switching
Non Preemptive prorite

p1 p3 p5 p4 p2
0 1 3 7
0 2 10 15 19 20

4 contex
switching
RR (quantum=2)

p1 p2 p1 p3 p4 p5 p3 p4 p5 p3 p4 p5
00 1 2 3 4 5 76 7 8 9 10 11 12

p3 p4 p5 p3 p5 p3 p3 p3
0
12 1
13 3
14 715 17
16 18 19 20

10 contex
switching
fcfs sjf nonpree Rr(quant fcfs sjf Non RR(2)
mptive um=2) Preem
ptive
Wating Wating Wating Wating turnar turnar Turna
time time time time ound ound round
time time time T.R.T
p1 0 0 0 1 2 0 0 1
p2 1 1 18 0 2 1 18 0
p3 1 10 0 10 9 10 0 10
p4 8 0 12 7 12 0 12 7
P5 11 3 6 8 16 3 6 8
Solution (d)

Ans c>
Average Waiting time of fcfs=(0+1+1+11+8)/5=21/5=4.2;
Average Waiting time of
sjf=(1+0+10+3+0)/5=2.8;
Average Waiting time of nonpreemptive=
=(0+18+0+12+6)/5=7.2;
Average Waiting time of
RR(quantum=2)=(1+0+10+7+8)/5=5.2;
SJf take minimum time MINIMUM WAITING TIME.

You might also like