Document
Document
QUESTION 1:
A CPU scheduling system receives five processes with the following
arrival and burst times:
PART A:
SO:
| P1 | P2 | P3 | P4 | P5 |
0 8 12 21 26 28
PART B:
Calculate the average waiting time (AWT) and average
turnaround time (TAT) for FCFS.
As we know to calculate AWT and TAT, we use this formula:
➢ Turnaround Time (TAT) = Completion Time - Arrival
Time
➢ Waiting Time (WT) = Turnaround Time - Burst Time
PART C:
Draw the Gantt chart using Shortest Job First (SJF) (non-
preemptive) scheduling.
Shortest Job First (SJF) (Non-Preemptive) Scheduling:
• The process with the shortest burst time is executed next.
• If two processes have the same burst time, the one that
arrived first is executed first.
| P1 | P5 | P2 | P4 | P3 |
0 8 10 14 19 28
PART D:
| P1 | P1 | P2 | P2 | P2 | P2 | P2 | P4 | P1 | P3 |
0 1 2 3 4 5 6 9 14 20
PART B:
(7 + 0 + 10 + 1) / 4 = 4.5 ms
(14 + 4 + 16 + 4) / 4 = 9.5 ms
PART C :
| P1 | P2 | P2 | P2 | P2 |P1 | P4 | P3 |
0 2 3 4 5 6 11 14 20
PART D :
(11 + 4 + 16 + 9) / 4 = 10 ms
(4 + 0 + 10 + 6) / 4 = 5 ms