Different Between SJF & FCFS: 1. Page 35, Use FCFS. Show Your Calculation, Compare With SJF. Which One Is Better, Why?

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

1. Page 35, use FCFS. Show your calculation, compare with SJF. Which one is better, why?

Process Burst Time Waiting Time Turnaround Time


P1 6 0 6–0=6
P2 8 6 14 – 0 = 14
P3 7 14 21 – 0 = 21
P4 3 21 24 – 0 = 24

P1 P2 P3 P4
0 6 14 21 24

Different Between SJF & FCFS

1. Average Wait Time

a) FCFS - Average Wait Time is (0 + 6 + 14 + 21) / 4 = 10.25 ms,

b) SJF - Average Waiting Time is = (3 + 16 + 9 + 0) / 4 = 7ms,

2. Turnaround Time

a) FCFS - Turnaround Time is = (6 + 14 + 21+24) / 4 = 16.25 ms,

b) SJF - Turnaround Time is = (6 + 24 + 16 + 3) / 4 = 12.25ms,

The assumption is that with FCFS, average time and turnaround time is at in maximum level.
SJF has been shown to be the fastest and smallest scheduling algorithm.
1. Page 41, use FCFS. Show your calculation, compare with SJF. Which one is better, why?

Process CPU Burst Waiting Time Turnaround Time


Job A 5 0 5–0=5
Job B 2 5 7–0=7
Job C 6 7 13 – 0 = 13
Job D 4 13 17 – 0 = 17
Job X 3 17 20 – 2 = 18
Job Y 1 20 21 – 2 = 19

A B C D X Y
0 5 7 13 17 20 21

Different Between FCFS & SJN

1. Average Wait Time

a) FCFS - Average Wait Time is (0 + 5 + 7 + 13 + 17 + 20) / 6 = 10.33 ms, and for the SJN -
Average Waiting Time is = 5.33ms,

b) FCFS - Turnaround Time is = (5 + 7 + 13 + 17 + 18 + 19) / 6 = 13.16 ms, and for the SJN-
Turnaround Time is = 8.83 ms,

The SJN algorithm is the quickest and most efficient.

You might also like