Project ForgeSign up free
Operating Systems
Process Scheduling
GATE 2012
Hard

Consider the 3 processes P1, P2 and P3 shown in the table:

Process | Arrival time | Time units required P1 | 0 | 5 P2 | 1 | 7 P3 | 3 | 4

The completion order of the 3 processes under the policies FCFS and RR2 (round robin scheduling with CPU quantum of 2 time units) are

  • AFCFS: P1,P2,P3 RR2: P1,P2,P3
  • BFCFS: P1,P3,P2 RR2: P1,P3,P2
  • FCFS: P1,P2,P3 RR2: P1,P3,P2
  • DFCFS: P1,P3,P2 RR2: P1,P2,P3

Explanation

FCFS completes processes strictly in arrival order: P1, P2, P3. Tracing RR2 (2-unit quantum): P1 runs 0-2 (3 left, requeued); P2 arrives at t=1; P2 runs 2-4 (5 left, requeued); P3 arrives at t=3; P1 runs 4-6 (1 left, requeued) [queue order now P3,P2,P1]; P3 runs 6-8 (2 left, requeued); P2 runs 8-10 (3 left, requeued); P1 runs its last 1 unit 10-11 and COMPLETES at t=11; P3 runs 11-13 and COMPLETES at t=13; P2 runs its remaining 3 units 13-16 and COMPLETES at t=16. So RR2 completion order is P1, P3, P2.

Source: GATE CS 2012 (2012)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free