In: Computer Science
What is the average waiting time for Processes If Operating System uses the First Come First Serve (FCFS) Scheduling Algorithm?
(P1=5 ms, P2=10 ms, P3=15 ms)
Process Order: P2, P1, P3
Select one:
a. 8.3
b. 11.7
c. 10
d. 6.7
a)8.3 (Option 1) is the average waiting time for Processes (Option 1 is correct )
Explanation:
First Come Frist Serve (FCFS):
(Non Preemptive means once the process started execution It will not be halted or stopped until it gets completely executed)
Calculating the Waiting time of each Process :
In cases if we are given Process Order Like A,B,C Then the Waiting time of a process is equal to the difference of the Burst times (Execution time) of all the Process before it and the Arrival time of the Process
Eg: Process Order A,B,C then Waiting time of C = Burst time of A + Burst time of B - Arrival time of C
Given P1=5 ms, P2=10 ms, P3=15 ms and the Process Order: P2, P1, P3
Note: As there is no Arrival time for any Process is given we have to consider all of them Arrived at the same time. Hence arrival times of P1,P2,P3 is 0
Waiting time of P2 = 0 (As there are no processes before P2)
Waiting time of P1 = Burst time of P2 - Arrival time of P1 = 10 - 0 = 10
Waiting time of P3 = Burst time of P2 + Burst time of P1 - Arrival time of P3 = 10 + 5 - 0 = 15
Average Waiting time of Process = (Waiting time of P2 + Waiting time of P1 +Waiting time of P3) / 3
= (0 + 10 + 15)/3
= 25/3
= 8.3
Hence 8.3 ms is the average waiting time for Processes.
Invalid Options:
b. 11.7 (Option 2) is not equivalent to 8.3 It is incorrect
c. 10 (Option 3) is not equivalent to 8.3 It is incorrect
d. 6.7 (Option 4) is not equivalent to 8.3 It is incorrect
If You Have Any Doubts. Please Ask Using Comments.
Have A Great Day!