375 views
1 1 vote

Consider the following set of processes, with arrival times and CPU burst times given in milliseconds. What is the average turnaround time for these processes using the Preemptive Shortest Remaining Processing Time First (SRPT/SRTF) algorithm?

\[
\begin{array}{c|c|c}
\text{Process} & \text{Arrival Time} & \text{Burst Time} \\
\hline
\text{P1} & 0 & 6 \\
\text{P2} & 2 & 2 \\
\text{P3} & 3 & 5 \\
\text{P4} & 5 & 2
\end{array}
\]

 

  1. $5.5$ ms
     
  2. $6.25$ ms
     
  3. $6.5$ ms
     
  4. $7$ ms

3 Answers

0 0 votes

To find the Average Turnaround Time, we first track the execution using a Gantt chart:

  • Time $\mathbf{0: P1}$ arrives and starts. $($Remaining: $\mathrm{P}1=6)$
     
  • Time $\mathbf{2: P2}$ arrives (Burst $=2$ ). $\mathrm{P1}$ has $4 \mathrm{~ms}$ remaining. Since $2<4, \mathbf{P2}$ preempts $\mathbf{P1}$ .
     
  • Time $\mathbf{3: P3}$ arrives (Burst $=5$ ). $\mathrm{P2}$ has $1 \mathrm{~ms}$ remaining. Since $1<5, \mathbf{P} 2$ continues.
     
  • Time $\mathbf{4: P2}$ finishes. Ready queue: P1 $(4 \mathrm{~ms})$, P3 $(5 \mathrm{~ms})$. $\mathbf{P1}$ resumes as it is the shortest.
     
  • Time $\mathbf{5: P4}$ arrives (Burst $=2$). P1 has $\mathrm{3 ~ms}$ remaining. Since $2<3, \mathbf{P4}$ preempts $\mathbf{P1}$.
     
  • Time $\mathbf{7: P4}$ finishes. Ready queue: $\mathrm{P1 ~(3 ~ms)}$, $\mathrm{P3 ~(5 ~ms)}$. $\mathbf{P1}$ resumes.
     
  • Time $\mathbf{10: P1}$ finishes. Ready queue: $\mathrm{P3 ~(5 ~ms)}$. $\mathbf{P3}$ starts.
     
  • Time $\mathbf{15: P3}$ finishes.
     


Turnaround Time (TAT) Calculation

$T A T=$ Completion Time $-$ Arrival Time


\[
\begin{array}{c|c|c|c}
\text{Process} & \text{Completion Time} & \text{Arrival Time} & \text{Turnaround Time} \\
\hline
\text{P1} & 10 & 0 & 10 \\
\text{P2} & 4 & 2 & 2 \\
\text{P3} & 15 & 3 & 12 \\
\text{P4} & 7 & 5 & 2
\end{array}
\]

$\text { Average TAT }=\frac{10+2+12+2}{4}=\frac{26}{4}=6.5$



Correct Answer : C

Answer:
Position:
Show:

Related questions

4 4 votes
3 3 answers
409
409 views
GO Classes asked Dec 31, 2025
409 views
Consider the following set of CPU-intensive processes. The operating system uses the Preemptive Shortest Remaining Time First (SRTF) scheduling algorithm.\[\begin{array}{...
2 2 votes
3 3 answers
554
554 views
GO Classes asked Dec 31, 2025
554 views
The sequence $\_\_\_\_$ is an optimal non-preemptive scheduling sequence for the following jobs which leaves the CPU idle for $\_\_\_\_$ unit(s) of time.\[\begin{array}{c...
1 1 vote
2 2 answers
412
412 views
GO Classes asked Dec 31, 2025
412 views
A program is structured using an overlay tree to fit into limited physical memory.What is the minimum partition size in physical memory required to run the longest possib...
5 5 votes
2 2 answers
311
311 views
GO Classes asked Dec 31, 2025
311 views
Consider a system where a CPU generates $\mathbf{32-}$bit virtual addresses with a page size of $\mathbf{8 ~KB}$. The system has a $\mathbf{2-way}$ set associative TLB th...