Consider the following 3 processes, with the length of the CPU burst time given in milliseconds:
| Process | Arrival Time | Burst Time |
|---|---|---|
| P1 | 0 | 8 |
| P2 | 1 | 4 |
| P3 | 2 | 9 |
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. 4.66
Explanation
At t=0 only P1 (burst 8) is ready, so it runs. At t=1, P2 (burst 4) arrives with less remaining work than P1's 7, so P1 is preempted and P2 runs. At t=2, P3 (burst 9) arrives but P2's remaining time (3) is still smallest, so P2 continues and finishes at t=5 (waiting = 5−1−4 = 0). P1 (remaining 7) now has less remaining work than P3 (9), so P1 runs uninterrupted from t=5 to t=12 (waiting = 12−0−8 = 4), and finally P3 runs alone from t=12 to t=21 (waiting = 21−2−9 = 10). Average waiting time = (0+4+10)/3 = 14/3 ≈ 4.67 ms, matching the printed option (ii) 4.66 (rounding).More Discrete Structures and Optimization questions
- Assuming that the system call fork() never fails, consider the following C programs P1 and P2 executed on a UNIX/Linux system. P1 P2 int ma…
- Consider the following four processes with the arrival time and length of CPU burst given in milliseconds: Process Arrival Time Burst Time…
- Which module gives control of the CPU to the process selected by the short-term scheduler?
- A fair share scheduler computes the priority of a process based on which of the following? (1) Processor utilization by the individual proc…
- Which of the following CPU scheduling algorithms may cause starvation of a process? (1) First-Come-First-Served (2) Round Robin (3) Priorit…
- A scheduling algorithm assigns a process's priority proportional to how long it has been waiting; every process starts at priority zero (th…