Practice mode Operating Systems

Processes P1, P2, P3 and P4 arrive at times 0, 1, 3 and 4 ms with burst times 9, 5, 2 and 6 ms. What is the average waiting time under preemptive SJF (shortest remaining time first)?

Correct answer C. 4.75 ms

Explanation

P1 runs 0-1; P2 (5) preempts P1 (8 left) and runs 1-3; P3 (2) preempts P2 (3 left) and runs 3-5; then P2 finishes 5-8, P4 runs 8-14 and P1 runs 14-22. Waiting time is finish minus arrival minus burst: P1 13, P2 2, P3 0, P4 4, total 19, average 4.75 ms. The value 10.25 ms is the average turnaround time.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.