UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 59)
Q 59. Consider the following three processes with the arrival time and CPU burst time given in milliseconds:
The Gantt Chart for preemptive SJF scheduling algorithm is _________.
(A)
0 7 13 21
(B)
0 1 5 11 19
(C)
0 7 13 19
(D)
0 4 12 19
Answer : (B)
Explanation :
A) Not preemptive. P1 continues execution without being preempted.
B) Preemptive SJF . P1 executes for 1 second followed by execution of P2 for 4 secs. Then P1 finishes execution followed by P3.
C) Not preemptive as each of the processes carries on execution without being preempted.
D)Preemptive but P2 starts execution even before it has arrived which can't happen in reality.
P1 arrive at 0 it will be served by CPU for 1 unit. After 1 unit P2 arrived ans it is shortest So it will execute for 4 unit, after its execution There are 2 processes out of which P1 is shortest so it will execute for 6 unit after its execution P1 will execute for 8 unit.
Q 59. Consider the following three processes with the arrival time and CPU burst time given in milliseconds:
Process | Arrival Time | Burst Time |
---|---|---|
P1 | 0 | 7 |
P2 | 1 | 4 |
P3 | 2 | 8 |
The Gantt Chart for preemptive SJF scheduling algorithm is _________.
(A)
P1 | P2 | P3 |
(B)
P1 | P2 | P1 | P |
(C)
P1 | P2 | P3 |
(D)
P2 | P3 | P1 |
Answer : (B)
Explanation :
A) Not preemptive. P1 continues execution without being preempted.
B) Preemptive SJF . P1 executes for 1 second followed by execution of P2 for 4 secs. Then P1 finishes execution followed by P3.
C) Not preemptive as each of the processes carries on execution without being preempted.
D)Preemptive but P2 starts execution even before it has arrived which can't happen in reality.
P1 arrive at 0 it will be served by CPU for 1 unit. After 1 unit P2 arrived ans it is shortest So it will execute for 4 unit, after its execution There are 2 processes out of which P1 is shortest so it will execute for 6 unit after its execution P1 will execute for 8 unit.
0 comments:
Post a Comment