272 views
7 7 votes

Consider three processes $P_1, P_2$, and $P_3$ arriving at time $t=0$ with burst times $10,5 ,$ and $8$ respectively. The scheduler uses Preemptive Shortest Remaining Time First (SRTF). A new process $P_4$ arrives at $t=3$ with a burst time of $2$.

Calculate the average waiting time for all four processes (round off to $2$ decimal places).

3 Answers

3 3 votes

At $t=0$ : Ready processes are $P_1(10), P_2(5), P_3(8)$. $P_2$ is the shortest.

At $t=3: P_2$ has remained $5-3=2 . P_4$ arrives with $B T=2$. Since $P_2$ and $P_4$ have equal remaining time, $P_2$ continues (tie-breaker: same process).

At $t=5: P_2$ finishes. Remaining: $P_4(2), P_3(8), P_1(10) . P_4$ runs next.

At $t=7: P_4$ finishes. Remaining: $P_3(8), P_1(10)$. $P_3$ runs next.

At $t=15: P_3$ finishes. $P_1$ runs last.

At $t=25: P_1$ finishes.
 

Wait Times $(W T=T A T-B T)$ :

  • $P_1: 25-10=15$
     
  • $P_2: 5-5=0$
     
  • $P_3: 15-8=7$
     
  • $P_4:(7-3)-2=2$
     

Average $W T: \frac{15+0+7+2}{4}=\frac{24}{4}=6.00$

Answer:
Position:
Show:

Related questions

5 5 votes
1 1 answer
286
286 views
GO Classes asked Feb 21
286 views
Consider a disk with a sector size of $512$ bytes, $2000$ tracks per surface, $50$ sectors per track, and $5$ double-sided platters. A file of size $1 \mathrm{MB}(1 \math...
5 5 votes
2 2 answers
232
232 views
GO Classes asked Feb 21
232 views
A system uses the LRU (Least Recently Used) page replacement algorithm with $3$ empty frames. The page reference string is: $1,2,1,3,7,4,1,2,1$.How many page faults will ...
3 3 votes
2 2 answers
222
222 views
GO Classes asked Feb 21
222 views
In a system with $5$ processes and $12$ identical resources, each process requires a maximum of $3$ resources to complete its execution.What is the minimum number of reso...
3 3 votes
1 1 answer
205
205 views
GO Classes asked Feb 21
205 views
A counting semaphore $S$ is initialized to $10 $. The following operations are performed in order:$8 P(S)$ operations, followed by $3 V(S)$ operations, followed by $1 P(S...