The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+15 votes
1.4k 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$
asked in Operating System by Veteran (59.6k points)
edited by | 1.4k views

3 Answers

+17 votes
Best answer

The answer is (B).

The Gantt chart of execution of processes
$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$

answered by Boss (19.7k points)
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  ...
+11 votes

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*}$

answer = option B

answered by Boss (30.8k points)
+2 votes

we can solve using this way 

answered by Active (3.8k points)
0
Total waiting time and waiting time are same thing or different????
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

40,748 questions
47,471 answers
145,585 comments
62,234 users