Question:

Consider the following process information for Shortest Remaining Time First (SRTF) scheduling:

\[ \begin{array}{|c|c|c|} \hline \textbf{Process} & \textbf{Arrival Time (AT)} & \textbf{Burst Time (BT)} \\ \hline P1 & 0 & 10 \\ P2 & 1 & 13 \\ P3 & 2 & 6 \\ P4 & 8 & 9 \\ \hline \end{array} \]

Find the turnaround time for each process.

Show Hint

In SRTF scheduling, always pick the process with the shortest remaining burst time. This helps minimize the turnaround time for processes.
Updated On: Feb 14, 2025
  • 19
  • 20
  • 18
  • 15
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Calculate the completion time for each process using the Shortest Remaining Time First (SRTF) scheduling algorithm.

SRTF is a preemptive version of the Shortest Job First (SJF) scheduling algorithm. It executes the process with the shortest remaining burst time.

1. Initially, process \( P1 \) starts executing at time 0.
2. Process \( P3 \) arrives at time 2, and has a burst time of 6, which is shorter than the remaining burst time of \( P1 \). Thus, \( P3 \) executes next.
3. After \( P3 \) completes at time 8, \( P1 \) resumes execution as it has the shortest remaining burst time.
4. Process \( P2 \) arrives at time 1, but \( P1 \) continues since it has less remaining burst time than \( P2 \).
5. After \( P1 \) completes at time 10, process \( P2 \) executes.
6. Process \( P4 \) arrives at time 8 but starts after \( P2 \) as it has a larger burst time.


Step 2: Calculate the turnaround time.

Turnaround time is the difference between the completion time and the arrival time.

\[ \text{Turnaround Time for } P1 = 10 - 0 = 10 \] \[ \text{Turnaround Time for } P2 = 19 - 1 = 18 \] \[ \text{Turnaround Time for } P3 = 8 - 2 = 6 \] \[ \text{Turnaround Time for } P4 = 19 - 8 = 11 \]

Thus, the average turnaround time is:

\[ \frac{10 + 18 + 6 + 11}{4} = 19 \, \text{units}. \]

Thus, the correct answer is \( 19 \).
Was this answer helpful?
0
0

Top Questions on Programming in C

View More Questions