To answer the questions, we need to calculate the Average Turnaround Time (ATT) for the given processes under different scheduling algorithms: FIFO (First In, First Out), SJF (Shortest Job First), and SRT (Shortest Remaining Time).
In FIFO, processes are executed in the order they arrive.
- Process p1 arrives at time 0 and needs 100 units of CPU time.
- Process p2 arrives at time 1 and needs 1 unit of CPU time.
Execution Order:
- p1 starts at time 0 and finishes at time 100.
- p2 starts at time 100 and finishes at time 101.
Turnaround Time Calculation:
- Turnaround time for p1 = Finish time - Arrival time = 100 - 0 = 100 units.
- Turnaround time for p2 = Finish time - Arrival time = 101 - 1 = 100 units.
Average Turnaround Time (ATT):
\[ \text{ATT} = \frac{\text{Turnaround time of p1} + \text{Turnaround time of p2}}{2} = \frac{100 + 100}{2} = 100 \text{ units} \]
The answer is 100 time units.
In SJF, the process with the shortest CPU time requirement is executed first.
- Process p1 arrives at time 0 and needs 100 units of CPU time.
- Process p2 arrives at time 1 and needs 1 unit of CPU time.
Execution Order:
- p2 starts at time 1 and finishes at time 2.
- p1 starts at time 0 and resumes at time 2, finishing at time 102.
Turnaround Time Calculation:
- Turnaround time for p1 = Finish time - Arrival time = 102 - 0 = 102 units.
- Turnaround time for p2 = Finish time - Arrival time = 2 - 1 = 1 unit.
Average Turnaround Time (ATT):
\[ \text{ATT} = \frac{\text{Turnaround time of p1} + \text{Turnaround time of p2}}{2} = \frac{102 + 1}{2} = 51.5 \text{ units} \]
The answer is 51.5 time units.
In SRT, the process with the shortest remaining time is executed next.
- Process p1 arrives at time 0 and needs 100 units of CPU time.
- Process p2 arrives at time 1 and needs 1 unit of CPU time.
Execution Order:
- p1 starts at time 0.
- p2 arrives at time 1 and preempts p1, starts at time 1 and finishes at time 2.
- p1 resumes at time 2 and finishes at time 102.
Turnaround Time Calculation:
- Turnaround time for p1 = Finish time - Arrival time = 102 - 0 = 102 units.
- Turnaround time for p2 = Finish time - Arrival time = 2 - 1 = 1 unit.
Average Turnaround Time (ATT):
\[ \text{ATT} = \frac{\text{Turnaround time of p1} + \text{Turnaround time of p2}}{2} = \frac{102 + 1}{2} = 51.5 \text{ units} \]
The answer is 51.5 time units.
- The ATT under FIFO is 100 time units.
- The ATT under SJF is 51.5 time units.
- The ATT under SRT is 51.5 time units.