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?
- A. A 16, B 14, C 6, D 20
- B. A 13, B 17, C 6, D 20
- C. A 16, B 14, C 6, D 19
- 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
- Three processes each run CPU burst, I/O burst, CPU burst (in ms): P1 arrives at 0 with 5, 4, 3; P2 arrives at 2 with 3, 6, 2; P3 arrives…
- Reference string: 2, 7, 2, 4, 1, 7, 3, 2, 4, 5, 1, 2, 7, 3, 5, 2. With 4 frames, initially empty, how many page faults do FIFO, LRU and…
- Reference string: 2, 7, 2, 4, 1, 7, 3, 2, 4, 5, 1, 2, 7, 3, 5, 2. Three frames, initially empty, are managed by the clock (second-chance)…
- Reference string: 2, 3, 4, 1, 2, 3, 1, 5, 2, 3, 4, 1, 5. How many page faults does FIFO give with 3 frames and with 4 frames, and LRU with…
- Reference string: 2, 7, 2, 4, 1, 7, 3, 2, 4, 5, 1, 2, 7, 3, 5, 2. Three frames, initially empty, use LFU replacement: the victim is the…
- Five processes P0-P4 share four resource types A, B, C, D. Allocation: P0 (0,1,0,1), P1 (2,0,0,1), P2 (1,1,1,0), P3 (0,0,2,1), P4…