CS FundamentalsVery hardGATE CS (PYQ pattern)
SRTF with processes (arrival, burst) in ms: P1 (0, 10), P2 (1, 6), P3 (2, 3), P4 (3, 8), P5 (5, 1), P6 (6, 2). Ties go to the earlier arrival. How many times is a running process preempted (taken off the CPU before it finishes)?
- A. 3
- B. 4
- C. 2
- D. 1
Correct answer: C. 2
Simulating one time unit at a time, the running process is replaced by another with a smaller remaining time 2 times (a switch after a completion is not a preemption).
More Operating Systems questions
- Fixed priorities H > M > L, preemptive, one CPU. L arrives at 0: computes 2 ms, locks mutex m, computes 4 ms, unlocks, computes 1 ms. M…
- A bounded buffer has 3 slots: empty = 3, full = 0, mutex = 1 (classic implementation where a blocked wait leaves the semaphore negative)…
- Each of 8 processes P0..P7 waits for at most one other process (single-instance resources). The wait-for relation is: P0 waits for P1, P1…
- Single resource type, 5 processes. Allocation: 2, 2, 0, 1, 4. Maximum: 3, 3, 8, 2, 6. Available = 3. The state is safe. What is the…
- Semaphores s = 1, t = 0. P1: wait(s); print A; print B; signal(s). P2: wait(s); print C; signal(s). P3: wait(t); print D; signal(s). P4…
- Semaphores a = 1, b = 0, c = 0. P1: wait(a); print x; signal(b). P2: wait(b); print y; signal(c). P3: wait(c); print z; signal(a). P4…