The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+12 votes
1.9k views

Consider the following table of arrival time and burst time for three processes $P0, P1$ and $P2.$

Process Arrival Time Burst Time
$P0$ $0$ ms $9$ ms
$P1$ $1$ ms $4$ ms
$P2$ $2$ ms $9$ ms

The pre-emptive shortest job first scheduling algorithm is used. Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three processes?

  1. $5.0$ ms
  2. $4.33$ ms
  3. $6.33$ ms
  4. $7.33$ ms
asked in Operating System by Veteran (101k points)
edited by | 1.9k views

1 Answer

+16 votes
Best answer

Answer is (A). $5$ms

Gantt Chart

$\text{ Average Waiting Time = } \dfrac{(0+4)+(0)+(11)}{3} = \text{ 5ms. }$

answered by Active (4.2k points)
edited by
+3

Scheduling is carried out only at arrival or completion of processes

Doesn't this statement mean non-pre emptiveness? Even though question asks us to calculate using the pre-emptive shortest job first scheduling algorithm. Blockquoted text confuses me. I even tried with non pre emptive scheduling and I get answer as 6.33ms (C). Could some one help me understand?

0
"Scheduling is carried out only at arrival or completion of processes"

Doesn't this statement mean non-pre emptiveness
0
Yes, that is what is done here! At time 0, only P0 is there which has a burst of 9units and is taken into execution. At time 1, P1 arrives whose BT is 4 which is less than P0's(8 now), hence P0 is pre empted and so on
0

@Shalini Dutta , what do you think of this statement,

"Scheduling is carried out only at arrival or completion of processes"

+6
yes , which means scheduling is carried out only when a process arrives/completes. By my explanation P0 os pre empted when P1 arrives(Note : arrival OR completion)
0
Thanks for the clarification. I misunderstood it.
0
"Scheduling is carried out only at arrival 'or' completion of processes".
It may seems like this statement makes the question about non preemptive shortest job first scheduling algo but the difference is made by "or" statement.
Tricked
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

39,751 questions
46,766 answers
140,657 comments
58,519 users