CS FundamentalsVery hardGATE CS (PYQ pattern)
Banker's algorithm with two resource types (R1, R2). Allocation: P0 (0,2), P1 (1,4), P2 (0,4), P3 (6,1), P4 (0,2). Maximum: P0 (1,4), P1 (4,7), P2 (7,4), P3 (6,5), P4 (1,3). Available = (0,0). The current state is unsafe. What is the minimum number of extra units of R2 (R1 unchanged) that must be added to Available to make the state safe?
- A. 4
- B. 5
- C. 3
- D. 7
Correct answer: A. 4
Compute Need = Max - Allocation and run the safety algorithm with Available R2 increased by 0, 1, 2, ...: the first value that lets all five processes finish is 4.
More Operating Systems questions
- Banker's algorithm, a single resource type, 6 processes P0..P5. Allocation: 1, 2, 2, 5, 3, 4. Maximum: 9, 3, 3, 7, 7, 9. Available = 1…
- The head is at cylinder 100 with pending requests 55, 58, 39, 18, 90, 160, 150, 38 and 184 (cylinders 0 to 199; no new requests arrive)…
- A machine uses 4-level paging, a TLB (10 ns lookup, done before every access) and 100 ns memory. On a TLB miss the walk first consults a…
- Memory access takes 200 ns. A page fault takes 8 ms if the victim page is clean and 20 ms if it must first be written back; 60% of victim…
- Free memory consists of three holes (start, size in KB): (0, 300), (400, 200), (700, 500); everything else is allocated. Operations in…
- On a Unix file system with an empty directory /tmp/x (call it X), these commands run: mkdir X/a; mkdir X/a/b; mkdir X/a/c; touch X/a/f; ln…