CS FundamentalsHardProduct-company MCQ pattern
Five processes P0–P4 and three resource types A, B, C. Allocation: P0 (1,0,1), P1 (2,1,1), P2 (0,1,2), P3 (1,1,0), P4 (0,0,2). Max: P0 (4,2,3), P1 (3,2,2), P2 (2,3,4), P3 (3,1,2), P4 (1,2,3). Available: (1,1,1). Using the Banker's algorithm, which of these is a safe sequence?
- A. P4, P1, P3, P0, P2
- B. P3, P1, P4, P0, P2
- C. P1, P3, P4, P0, P2
- D. P0, P1, P3, P4, P2
Correct answer: C. P1, P3, P4, P0, P2
Need = Max − Allocation: P0 (3,2,2), P1 (1,1,1), P2 (2,2,2), P3 (2,0,2), P4 (1,2,1). Only P1 fits in (1,1,1); then Work = (3,2,2) → P3 → (4,3,2) → P4 → (4,3,4) → P0 → (5,3,5) → P2. Starting with P3 or P4 fails because their need exceeds (1,1,1).
More Operating Systems questions
- Two processes must run statements S1 (in P1) and S2 (in P2) such that S2 never executes before S1. Using one semaphore sync, which is…
- A system has 32-bit virtual addresses, 4 KB pages and 4-byte page-table entries, and every page table must fit exactly in one page. How…
- A Unix-style inode has 12 direct pointers, 1 single-indirect and 1 double-indirect pointer. The block size is 1 KB and a block pointer is…
- Memory holes, in order, are 150 KB, 450 KB, 250 KB, 350 KB and 500 KB. Requests arrive in order: 240 KB, 410 KB, 130 KB, 380 KB. Which…
- What does this program print? (Assume fork() succeeds; the order of the two lines may vary.) c int x = 5; int main() { if (fork() == 0)…
- A resource-allocation graph contains a cycle. Which conclusion is correct?