Op Tutorial Process State
Op Tutorial Process State
New terminated
Ready runningg
g
waiting
2. Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:
a) Draw a Gantt chart illustrating the execution of these processes using RR, FIFO, SJF (Shortest
Job First) & Priority (lowest number is high priority).
i. RR:
P1 P2 P3 P4 P5 P1 P2 P3 P4 P1 P2 P3 P1 P2 P3 P3 P3 P3 P3
0 3 6 9 12 14 17 20 23 26 29 32 35 36 38 41 44 47
50 51
Tw(P1)= (11+9+6)= 26
Tw(P2)= (3+11+9+6)= 29
Tw(P3)= (6+11+9+3)= 29
Tw(P4)= (9+11)= 20
Tw(P5)= (12) =12
Tw(average)= (26+29+29+20+12)/5 =23.2miliseconds
Turnaround time:
P1= 26+10=36
P2=29+11=40
P3=29+22=51
P4=20+6=26
P5+12+2=14
Average TT(36+40+51+26+14)/5=33.4
ii. FIFO:
P1 P2 P3 P4 P5
0 10 21 43 49 51
P1=0
P2=10
P3=21
P4=43
P5=49
Average waiting time= (10+21+43+49)=24.6
Turnaround time:
P1=10
P2=21
P3=43
P4=49
P5=51
Average TT=(10+21+43+49+51)/5=34.8
iii. SJF:
P5 P4 P1 P2 P3
0 2 8 18 29 51
Waiting time:
P1=8
Turnaround time:
P1=18
P2=29
P3=51
P4=8
P5=2
Average time= (18+29+51+8+2)/5=21.6
iv. Priority:
P3 P1 P4 P5 P2
0 22 32 34 40 51
Waiting time:
P1=22
P2=40
P3=0
P4=32
P5=38
Average time= (22+40+32+38)/5+26.4
Turnaround time:
P1=32
P2=51
P3=22
P4=38
P5=40
Average time:
(132+32)/5=32.8