380 views
2 2 votes

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 average waiting time under FCFS scheduling and the average waiting time under non-preemptive SJF scheduling.

Give the answer up to two decimal places.

2 Answers

0 0 votes

Using FCFS scheduling:

$|^{0} P1 |^{8} P2 |^{12} P3 |^{14} P4 |^{15}$

Average waiting time = (0+8+12+14)/4 = 8.5

Using non-preemptive SJF scheduling :

$|^{0} P4 |^{1} P3 |^{3} P2 |^{7} P1 |^{15}$

Average waiting time = (0+1+3+7)/4 = 2.75

So, difference between average waiting time of both : 8.5 - 2.75 = 5.75

0 0 votes

Under FCFS, the order is:

$P_1 \rightarrow P_2 \rightarrow P_3 \rightarrow P_4$

Waiting times are:

$P_1 = 0$

$P_2 = 8$

$P_3 = 8+4 = 12$

$P_4 = 8+4+2 = 14$

Average waiting time:

$\frac{0+8+12+14}{4} = \frac{34}{4} = 8.50$

Under non-preemptive SJF, the order is:

$P_4 \rightarrow P_3 \rightarrow P_2 \rightarrow P_1$

Waiting times are:

$P_4 = 0$

$P_3 = 1$

$P_2 = 1+2 = 3$

$P_1 = 1+2+4 = 7$

Average waiting time:

$\frac{0+1+3+7}{4} = \frac{11}{4} = 2.75$

Therefore, the required difference is:

$8.50 - 2.75 = 5.75$

Answer : $\boxed{5.75}$

Answer:
Position:
Show:

Related questions

6 6 votes
2 2 answers
286
286 views
GO Classes asked Jul 23
286 views
Match the following$$\begin{array}{ll}\text{I. FCFS} & \text{i. Optimal Waiting Time} \\\text{II. SJF} & \text{ii. Convoy effect} \\\text{III. Round Robin} & \text{iii. N...
3 3 votes
3 3 answers
235
235 views
GO Classes asked Jul 22
235 views
Consider the following processes. All processes arrive at the same time.\[\begin{array}{c|c|c}\text{Process} & \text{Burst Time} & \text{Priority} \\\hlineP_1 & 10 & 3 \\...
1 1 vote
1 1 answer
223
223 views
GO Classes asked Jul 20
223 views
Which of the following statements are correct? A FIFO scheduler has lower average turnaround time when long jobs arrive after short jobs, compared with when short jobs ar...
4 4 votes
1 1 answer
183
183 views
GO Classes asked Jul 20
183 views
Consider the following processes: $$\begin{array}{|c|c|c|}\hline\text{Job} & \text{Arrival Time} & \text{CPU Burst Time} \\ \hline A & 0 & 8 \\ B & 2 & 4 \\ C & 5 & 7 \\ ...