Questions: Process p1 arrives at time 0 and will need 100 units of CPU time. Process p2 arrives at time 1 and will need 1 unit of CPU time. 1) The ATT under FIFO will be time units. 2) The ATT under SJF will be time units. 3) The ATT under SRT will be time units.

Process p1 arrives at time 0 and will need 100 units of CPU time. Process p2 arrives at time 1 and will need 1 unit of CPU time.
1) The ATT under FIFO will be time units.
2) The ATT under SJF will be time units.
3) The ATT under SRT will be time units.
Transcript text: Process p1 arrives at time 0 and will need 100 units of CPU time. Process p2 arrives at time 1 and will need 1 unit of CPU time. 1) The ATT under FIFO will be $\qquad$ time units. $\square$ Check Show answer 2) The ATT under SJF will be $\qquad$ time units. $\square$ Check Show answer 3) The ATT under SRT will be $\qquad$ time units. $\square$ Check Show answer Feed
failed

Solution

failed
failed

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).

1) The ATT under FIFO

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:

  1. p1 starts at time 0 and finishes at time 100.
  2. 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.

2) The ATT under SJF

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:

  1. p2 starts at time 1 and finishes at time 2.
  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.

3) The ATT under SRT

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:

  1. p1 starts at time 0.
  2. p2 arrives at time 1 and preempts p1, starts at time 1 and finishes at time 2.
  3. 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.

Summary
  1. The ATT under FIFO is 100 time units.
  2. The ATT under SJF is 51.5 time units.
  3. The ATT under SRT is 51.5 time units.
Was this solution helpful?
failed
Unhelpful
failed
Helpful