The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+12 votes
1.1k 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 (69k points) | 1.1k views

3 Answers

+16 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 Veteran (19.8k points)
selected by
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?

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

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

Process is executed on the basis of their remaining time in execution  ...
+9 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 Veteran (31k points)
+1 vote

we can solve using this way 

answered by Loyal (3.9k points)
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

33,646 questions
40,193 answers
114,178 comments
38,664 users