CS FundamentalsVery hardGATE CS (PYQ pattern)
Banker's algorithm with 3 resource types. Allocation: P0 (1,0,0), P1 (1,2,0), P2 (0,0,0), P3 (1,4,3), P4 (3,1,1). Maximum: P0 (5,3,2), P1 (5,6,1), P2 (4,1,2), P3 (3,6,5), P4 (5,2,1). Available = (2,3,3). Two requests arrive, each to be judged separately against this state: R1 = P3 asks (2,0,2); R2 = P0 asks (1,0,0). Both are within the process's declared maximum. Which request(s) can be granted immediately while keeping the system safe?
- A. R1 only
- B. R2 only
- C. Both R1 and R2
- D. Neither R1 nor R2
Correct answer: A. R1 only
Pretend to grant each request, subtract it from Available and Need, and run the safety algorithm. R1 leaves a safe state; R2 can be satisfied from Available but leads to a state with no safe sequence, so it must wait.
More Operating Systems questions
- Every fork() succeeds, wait() blocks until some child has terminated (it returns at once if the caller has no un-waited children), and…
- A buddy allocator manages 1024 KB (minimum block 16 KB, requests rounded up to powers of two; the lowest-addressed free block of the…
- A 128 KB physically-tagged, virtually-indexed L1 cache has 64-byte lines and is 16-way set-associative. The system uses 4 KB pages. How…
- A machine has 2 GB of RAM; the OS occupies 512 MB and every user process needs 192 MB, so as many whole processes as fit are kept in…
- Highest Response Ratio Next (non-preemptive; ratio = (waiting time + burst) / burst, evaluated whenever the CPU becomes free) schedules…
- Four processes with CPU bursts 10, 4, 2 and 1 ms arrive together at time 0 in that order and are scheduled by Round Robin with quantum 3…