142k views
4 votes
Consider the following set of processes, the length of the CPU burst time given in milliseconds :

Process Burst time
P1 6
P2 8
P3 7
P4 3
ii) Assuming the above process being scheduled with the SJF scheduling algorithm :
a) The waiting time for process P2 is 3ms.
b) The waiting time for process P2 is 0ms.
c) The waiting time for process P2 is 16ms.
d) The waiting time for process P2 is 9ms.

User Saad Ahmed
by
8.3k points

1 Answer

2 votes

Final answer:

The waiting time for process P2 under the Shortest Job First (SJF) scheduling algorithm is 16ms, as P2 has to wait for the completion of processes P4, P1, and P3 with burst times of 3ms, 6ms, and 7ms respectively.

Step-by-step explanation:

In SJF (Shortest Job First) scheduling algorithm, the process with the shortest burst time is executed first. The waiting time for each process is the total time it spends waiting in the ready queue before its execution starts. To determine the waiting time for process P2 in this scenario, we need to calculate the total burst time of processes with shorter burst times than P2.

Looking at the given burst times, P1 has a burst time of 6 and P4 has a burst time of 3, which are both shorter than P2's burst time of 8. Therefore, the waiting time for process P2 would be 6ms + 3ms = 9ms.

User Ivelina
by
8.5k points