CS FundamentalsVery hardProduct company interview · GATE level

A multilevel feedback queue has Q0 (Round Robin, quantum 2), Q1 (Round Robin, quantum 4) and Q2 (FCFS). New processes enter Q0. A process that uses its whole quantum moves down one level. A process running from a lower queue is preempted as soon as a process arrives in a higher queue; the preempted process goes to the tail of its own queue and gets a fresh quantum later. Processes (arrival, burst): A (0, 7), B (1, 5), C (3, 2), D (9, 6). What are the completion times of A, B, C and D?

  1. A. A 16, B 14, C 6, D 20
  2. B. A 13, B 17, C 6, D 20
  3. C. A 16, B 14, C 6, D 19
  4. D. A 12, B 16, C 6, D 20

Correct answer: A. A 16, B 14, C 6, D 20

A runs 0-2 in Q0 and drops to Q1. B runs 2-4 in Q0 and drops to Q1 (queue A, B). C runs 4-6 in Q0 and finishes. A runs from Q1 at 6, but D arrives in Q0 at 9, so A is preempted after 3 units and goes behind B. D runs 9-11 and drops to Q1 (queue B, A, D). B runs its last 3 units 11-14, A its last 2 units 14-16, D its last 4 units 16-20. Letting A finish its full Q1 quantum before D runs gives A 13 and pushes B to 17.

More Operating Systems questions

Exams that ask this topic