Let’s tackle each scheduling algorithm one by one:
First-Come, First-Served (FCFS):
- Gantt Chart:
| P1 | P2 | P3 | P4 | P5 |
- Turnaround Time:
P1: 8 ms
P2: 11 ms
P3: 15 ms
P4: 22 ms
P5: 28 ms
- Waiting Time:
P1: 0 ms
P2: 8 ms
P3: 11 ms
P4: 15 ms
P5: 22 ms
Shortest Job First (SJF):
- Gantt Chart:
| P2 | P3 | P1 | P5 | P4 |
- Turnaround Time:
P1: 12 ms
P2: 3 ms
P3: 7 ms
P4: 21 ms
P5: 9 ms
- Waiting Time:
P1: 4 ms
P2: 0 ms
P3: 3 ms
P4: 14 ms
P5: 3 ms
Shortest Remaining Time Next (SRTN):
- Gantt Chart:
| P2 | P3 | P1 | P1 | P1 | P1 | P1 | P5 | P5 | P5 | P5 | P5 | P4 | P4 | P4 | P4 |
- Turnaround Time:
P1: 28 ms
P2: 3 ms
P3: 7 ms
P4: 21 ms
P5: 15 ms
- Waiting Time:
P1: 20 ms
P2: 0 ms
P3: 3 ms
P4: 14 ms
P5: 9 ms
Priority-Based Scheduling:
- Gantt Chart:
| P2 | P4 | P1 | P3 | P5 |
- Turnaround Time:
P1: 19 ms
P2: 3 ms
P3: 11 ms
P4: 10 ms
P5: 14 ms
- Waiting Time:
P1: 11 ms
P2: 0 ms
P3: 7 ms
P4: 3 ms
P5: 8 ms
Round Robin (Quantum = 2):
- Gantt Chart:
| P1 | P2 | P3 | P4 | P5 | P1 | P4 | P5 | P1 | P5 | P1 |
- Turnaround Time:
P1: 28 ms
P2: 14 ms
P3: 11 ms
P4: 20 ms
P5: 15 ms
- Waiting Time:
P1: 20 ms
P2: 11 ms
P3: 7 ms
P4: 13 ms
P5: 9 ms
Conclusion:
The schedule with minimal average waiting time is Shortest Job First (SJF), as it has the shortest average waiting time among all the scheduling algorithms.