arrival time Bust time pl for the above table, under FCFS scheduling, processes
ID: 3912726 • Letter: A
Question
arrival time Bust time pl for the above table, under FCFS scheduling, processes are scheduled as follows: a. pl, p4, p2, p3 b. pl, p2, p4, p3 c. pl, p2, p3, p4 d. p2, p4, p3, pl arrival time Bust time 13 for the above table, under SJF scheduling, processes are scheduled as follows c. d. p3, pl, p4, p3 X pl, p3, p4, p2 pl, p3, p2, arrival time Bust time 13 for the above table, under round robin (with time quantuam equals 4) scheduling a. Average waiting time equals 10 c. process 4 finishes its burst before d. none of the above b. Average response time equals 15 . OS estimates the next CPU burst for SJF scheduling by using an equation like 0 20 37 57 77 97 117 121 134 154 for the above gant chart, using round robin scheduling a. P1 burst time equals 44 b. time quantum equals 17 162 p3 burst equals 57 p4 is less than pl in burst time c. d.Explanation / Answer
1. Under First come first serve scheduling(FCFS), the process which comes first will be served first, if more than one process come at same time, one of them will be served first
P1 and P2 arrive at same time t:0 Hence there will be 2 scenarios
(1) If P1 is served first and then P2 will be served.P3 will be served next as P4 arrives after P3 . The order is P1,P2,P3,P4
(2)
If P2 is served first and then P1 will be served.P3 will be served next as P4 arrives after P3 . The order is P2,P1,P3,P4.
Hence both P1,P2,P3,P4 or P2,P1,P3,P4 are correct. Only one option is provided . Hence choose (c)
2. In SJF(shortest Job First) the process which has short burst time will be served first . P1 and P2 arrive at same time. As P1 has short burst time when compared to P2 it will be served first . At time 4: the burst time left for P1,P2,P3 is as follows 2(6-4),8,5.
At time 6: P1 is completed and we are left with P2,P3.As P3 burst time(5) is less than P2 burst time (8). It is served next.
At time 11 : P3 is completed and we have one process P2 with burst time 8.
At time 13 : P2 is left with burst time 6(8-(13-11)). P4 arrives with burst time 7, as P2 burst time is less than P4.P2 will be completed first, later P4 will be served.
Hence it is P1,P3,P2,P4. Choose (b)
3. Time 0: P1 is allocated 4
Time 4: P2 is allocated 4. P1 burst time left 2(6-4).P3 arrives with burst time 5 .waiting time of P1,P2,P3 are 0,4,0
Time 8: P3 is allocated 4.P1 needs 2, P2 needs 4(8-4).waiting time of P1,P2,P3 are 4,4,4
Time 12: P1 is allocated 2 . P2 needs 4, P3 needs 1(5-4).waiting time of P1,P2,P3 are 8,8,4
Time 13 : P4 arrives with burst time 7 and joins at the end of the queue.
Time 14 : P1 is completed and P2 is served now.waiting time of P1,P2,P3,P4 are 8,10,6,1
Time 18: P2 is completed and P3 will be served now.waiting time of P1,P2,P3,P4 are 8,10,10,5.
Time 19 : P3 is completed and P4 will be served now.waiting time of P1,P2,P3,P4 are 8,10,10,6.
As only P4 is left it will be completed by 19+7=26
average waiting time=(8+10+10+6)/4=8.5
average response time is calculated at which the process is executed for the first time ( for P1 it is 0 as it is served at time 0, for P2 it is 4 as it is served at time 4, for P3 it is 8 as it is served first time at time 8, for P4 it is 19, as it served first time at 19) average response time =(0+4+8+19)/4=7.75
Process P2 finishes before P4
Hence the correct choice is (d)
4." ? n+1 = a*Tn + (1-a) * ? n" is used by OS for estimating the next cpu burst for SJF scheduling.
5. P1 burst time=(20-0)+(97-77)+(134-121)=20+20+13=53
time quantum=20
P3 burst time=(57-37)+(117-97)+(154-134)+(162-154)=20+20+20+8=68
P4 burst time=(77-57)+(121-117)=20+4=24
Hence P4 is less than P1 in burst time
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.