CS FundamentalsVery hardGATE CS · Amazon/Microsoft SDE MCQ
SRTF scheduling (on a tie the running process continues); processes (arrival, burst): P1 (0, 7), P2 (2, 4), P3 (4, 1), P4 (5, 4), P5 (9, 2). What is the average waiting time, and how many context switches occur after the first dispatch?
- A. 3.2 and 6
- B. 3.2 and 5
- C. 2.8 and 6
- D. 3.6 and 7
Correct answer: A. 3.2 and 6
Gantt: P1 0-2, P2 2-4, P3 4-5, P2 5-7, P4 7-11 (P5 arrives at 9 tying P4's remaining 2, so P4 continues), P5 11-13, P1 13-18. Waits 11, 1, 0, 2, 2 average 3.2, and the 7 segments mean 6 switches.
More Operating Systems questions
- A loop references pages 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 with 3 frames, initially empty. How many faults occur under FIFO, LRU and OPT?
- Banker's algorithm, resources (A, B, C). Available = (1, 1, 2). Allocation / Max: P0 (1,0,1)/(2,1,2), P1 (2,1,0)/(3,2,2), P2…
- How many times is x printed? (Every fork() succeeds, and each print is an unbuffered write.) c int main() { fork(); fork() && fork()…
- How many numbers are printed, and what is their sum? (Every fork() succeeds, and each print is an unbuffered write.) c int main() { for…
- Which letters are printed, and how many times each? (Every fork() succeeds, and each print is an unbuffered write.) c int main() { if…
- Periodic tasks T1 (execution 2, period 5) and T2 (execution 4, period 7), deadlines equal to periods. Which statement is correct?