• retagged by
804 views
1 1 vote

Consider a Shortest Job First (SJF) CPU scheduler, with the following process workload:

Process Arrival Time CPU Burst
$P1$ $t$ $5$
$P2$ $t+6$ $7$
$P3$ $t+10$ $5$
$P4$ $t+2$ $3$
$P5$ $t+8$ $9$
$P6$ $t+4$ $1$

Assume that the CPU is free and no other processes exist in the ready queue when P1 enters the ready queue at time t. Determine the schedule of process execution and compute the wait times for each of the above six processes. Which of the following is a TRUE statement about the average wait time and the maximum wait time for the six processes?

 
  a)  The average wait time is between 5.0 and 5.5 time units; the maximum wait time is between 11 and 12 time units.
  b)  The average wait time is between 4.0 and 4.5 time units; the maximum wait time is between 12 and 13 time units.
  c)  The average wait time is between 3.5 and 4.0 time units; the maximum wait time is between 11 and 12 time units.
  d)  The average wait time is between 4.5 and 5.0 time units; the maximum wait time is between 11 and 12 time units.

1 Answer

Best answer
2 2 votes

Answer : B

Assuming  Non-preemptive SJF algorithm (Because if it were Preemptive then they would have used SRTF or Preemptive SJF terminology )

Gantt Chart :

$t$ to $t+5$ $t+5$ to $t+6$ $t+6$ to $t+9$ $t+9$ to $t+16$ $t+16$ to $t+21$ $t+21$ to $t+30$
P1 P6 P4 P2 P3 P5

So, Waiting times of all the processes :

Process Waiting time
P1 0
P2 3
P3 6
P4 4
P5 13
P6 1

Hence, Avg Waiting time = $4.5$ and Max waiting time = $13$ Units of time.

• selected by
Position:
Show:

Related questions

1 1 vote
0 0 answers
5.7k
5.7k views
iarnav asked Jul 11, 2018
5,731 views
Let's say we have two CPU scheduling algorithm as SJF and SRTF and we have a arbitrary pool/set of processes with different ARRIVAL TIME and CPU BURST, then what CPU sch...
1 1 vote
1 1 answer
153
153 views
GO Classes asked Aug 26
153 views
A system uses two feedback queues:$\text{Q1}$: Round Robin with time quantum $10$ ms $\text{Q2}$: Shortest Job First $\text{Q1}$ has higher priority than $\text{Q2}$ New ...
1 1 vote
1 1 answer
180
180 views
naveendewangan asked Aug 14
180 views
SJF suffers from convoy effect ? It states "SJF will not preempt a current long job that arrives before shorter jobs." So please clarify this whether SJF suffers from con...
2 2 votes
2 2 answers
327
327 views
GO Classes asked Aug 3
327 views
Four processes arrive at time $0$ in the following order:$P_1,\ P_2,\ P_3,\ P_4$Their CPU burst times are:$P_1=8$$P_2=4$$P_3=2$$P_4=1$Calculate the difference between the...