1.5k views

An operating system used Shortest Remaining System Time first (SRT) process scheduling algorithm. Consider the arrival times and execution times for the following processes:

 Process Execution Time Arrival time $P1$ $20$ $0$ $P2$ $25$ $15$ $P3$ $10$ $30$ $P4$ $15$ $45$

What is the total waiting time for process $P2$?

1. $5$
2. $15$
3. $40$
4. $55$
edited | 1.5k views

 $P1$ $P2$ $P3$ $P2$ $P4$

$0$                $20$                 $30$                $40$                $55$                $70$

Waiting time for process $P2 =$ Completion time $–$ Arrival time $–$ burst time $= 55 – 15 – 25 = 15$

edited by
–1
Ans should be A)..

@Gate Keeda- why process P2 will preempt? At 30 th time both P2 and P3 have same remaining time,  CPU will not switch to P3. it continue executing P2..right?
0

No.At time 30th both do not have same remaining time. P3 has 10 and P2 has 15. Check that again to make sure.

+1

Could anyone explain why the process is pre-empted ? IS SRT pre-emptive if not mentioned ?

EDIT  : SRTN is pre emptive form of SJF

http://www.moreprocess.com/process-2/shortest-job-first-sjf-shortest-remaining-time-next-srtn-scheduling-algorithm

0
Process is executed on the basis of their remaining time in execution  ...

For process $P2$ :
\begin{align*} \text{Waiting Time} &= \text{TAT} - \text{BT}\\ &= \left ( \text{CT-AT}\right) - BT \\ &= \left( 55 - 15 \right ) - 25 \\ &= 15 \end{align*}

we can solve using this way

0
Total waiting time and waiting time are same thing or different????

1
2