**Q8. Consider the following:**

**Arrive Time Process Burst Time**

**0 P1 10**

**1 P2 4**

**2 P3 3**

**3 P4 1 **

**Draw Gantt Chart and calculate average turnaround and waiting time using Shortest Job First Scheduling Algorithm. **

**Grant Chart:**

P1 |
P2 |
P4 |
P2 |
P3 |
P1 |

**0 1 3 4 6 9 18**

**Turnaround Time**

P1=18-0=18

P2=6-1=5

P3=9-2=7

P4=4-3=1

**Average Turnaround Time**

=(18+5+7+1)/4

=31/4

=7.77 ms

**Waiting Time**

P1’s waiting time=9-1=8

P2’s waiting time=4-3=1

P3’s waiting time=6-2=4

P4’s waiting time=3-3=0

**Average Waiting Time**

=(8+1+4+0)/4

=13/4

=3.25 ms