Consider the following 3 processes

Consider the following 3 processes with the length of the CPU burst time given in milliseconds:

What is the average waiting time for these processes if they are scheduled using preemptive shortest job first scheduling algorithm?
i➥ 2.66
ii➥ 4.66
iii➥ 5.5
iv➥ 6
Answer: Option II 

Solution:
Preemptive shortest job first scheduling algorithm
Preemptive SJF algorithm will preempt the currently executing process. Preemptive SJF scheduling is sometimes called shortest remaining time first algorithm.

Formula used,
Turn Around Time = Completion Time - Arrival Time,
Waiting Time = Turn Around Time - Burst Time,

Average Waiting Time = Total waiting Time / number of process

Calculation,

Gantt Chart
Consider the following 3 processes with the length of the CPU burst time given in milliseconds

Completion Time(CT) for P1 = 12,
Completion Time(CT) for P2 = 5,
Completion Time(CT) for P3 = 21,

Turn Around Time(TAT) for P1 = CT-AT = 12-0 = 12, 
Turn Around Time(TAT) for P2 = CT-AT = 5-1 = 4, 
Turn Around Time(TAT) for P3 = CT-AT = 21-2 = 19, 

Waiting Time(WT) for P1 = TAT-BT = 12-8 = 4,
Waiting Time(WT) for P2 = TAT-BT = 4-4 = 0,
Waiting Time(WT) for P3 = TAT-BT = 19-9 = 10.

What is the average waiting time for these processes if they are scheduled using preemptive shortest job first scheduling algorithm?
   
Average Waiting Time = (4+0+10)/3
                     = 14/3
                     = 4.66            

So, Option(II)is correct. 

More related Questions on Page fault
Read more
More related Questions on Operating System
Read more
More Questions on June 2021
Read more

You are welcome to give the better solution for this question

Leave a Comment

Your email address will not be published.

error: Content is protected !!
Open chat
1
Hi,how Can We Help You ?