+14 votes
1.5k views

Consider the following set of processes, with the arrival times and the CPU-burst times gives in milliseconds.

Process Arrival Time Burst Time
$P1$
$P2$
$P3$
$P4$
$0$
$1$
$2$
$4$
$5$
$3$
$3$
$1$

What is the average turnaround time for these processes with the preemptive shortest remaining processing time first (SRPT) algorithm?

1. $5.50$
2. $5.75$
3. $6.00$
4. $6.25$
asked
edited | 1.5k views

## 2 Answers

+18 votes
Best answer

$0---P_1---1---P_2---4---P_4---5---P_3---8---P1---12$

Process       waiting time = (Turnaround time - Burst time ) turnaround time = ( Completion Time - Arrival Time )
$P1$ $7$ $12$
$P2$ $0$ $3$
$P3$ $3$ $6$
$P4$ $0$ $1$

Avg turnaround time $=12+3+6+1/4=22/4=5.5$

answered by Boss (31.8k points)
edited by
0
How waiting time for p1 is 8?
–1
It should be 7.
0
Waiting Time for P1 should be 7. Please rectify it.
0
It is because the BT for P1 is 5, TAT is 12 and WT = TAT-BT so that's why WT is 7.
0
how p3 tat is 6?
–4 votes
5.750
answered by (3 points)
Answer:

+20 votes
4 answers
1
+18 votes
3 answers
2
+32 votes
4 answers
3