# Numerical Solved by Priority Scheduling

Q2. Consider the following set of processes with given priorities and burst time assumed to be arrived at 0.

Process                Priority                Burst Time

P1                           3                              6

P2                           2                              2

P3                           1                              14

P4                           4                              6

Draw Gantt Chart and calculate average turnaround and waiting time using Priority Scheduling Algorithm.

Ans. When priority scheduling is implemented the following sequence of processes would be generated:

Gantt Chart:

 P3 P2 P1 P4

0                                 14               16                                           24                                      32

P1’s waiting time=16

P2’s waiting time=14

P3’s waiting time=0

P4’s waiting time=24

Average Waiting Time

=(16+14+0+24)/4

=13.5 millisecond

Turnaround Time

Turnaround Time = Burst Time + Waiting Time

Process                     Turnaround Time

P1                               6+16=22

P2                               2+14=16

P3                               14+0=14

P4                               6+24=30

Average Turnaround Time

=(22+16+14+30)/4

=20.5 milliseconds

141 Views