in Operating System edited by
12,485 views
29 votes
29 votes

Consider the following table of arrival time and burst time for three processes $P0, P1$ and $P2.$$$\small \begin{array}{|c|c|c|} \hline \textbf{Process} & \textbf{Arrival Time} & \textbf{Burst Time}\\\hline \text{P0} & \text{0 ms} & 9 \\\hline \text{P1} & \text{1 ms} & 4 \\\hline \text{P2} & \text{2 ms} & 9 \\\hline  \end{array}$$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
in Operating System edited by
12.5k views

1 Answer

33 votes
33 votes
Best answer

Answer is (A). $5$ms

Gantt Chart

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

edited by

4 Comments

Notice the "or" word in the Quoted Text @Nitish Gate Questions Tricks you
0
0

@jatin, Doesn’t SRTF schedules both during arrival of process and also at end of process(When a process A was pre-empted due to Process B, after Process B completes , A is considered for scheduling).

 

Can some-one pls explain the Significance of OR in the question, I am confused 

 

0
0

@Mohank it simply means that scheduling will happen if a process arrives or completes(Observe When P0 had executed for 1ms then at t=1 P1 arrives and since it is mentioned in the question that scheduling can happen if a process arrives, so srtf will now schedule process P1 because it has shorter Burst time) at T=2 again process P3 arrives then scheduling will happen again and so on.

If the question had been “Scheduling is carried out only at arrival AND completion of processes.” then it would have been non-preemptive because at t=1 even if P1 arrives the process P0 has not yet completed its execution, only at T=9 scheduling will happen because at that time a process has completed it execution and other processes have already arrived.

4
4
Answer:

Related questions