CS FundamentalsVery hardGATE CS
Banker's algorithm, resources (A, B, C). Available = (2, 2, 1). Allocation / Max: P0 (1,1,2)/(5,3,4), P1 (2,0,1)/(3,2,2), P2 (3,0,2)/(7,0,3), P3 (1,1,1)/(2,2,3), P4 (0,0,2)/(4,3,3). Which single request can be granted immediately?
- A. P3 requests (1, 1, 1)
- B. P0 requests (1, 0, 1)
- C. P4 requests (1, 2, 0)
- D. P1 requests (1, 2, 1)
Correct answer: D. P1 requests (1, 2, 1)
Needs are P0 (4,2,2), P1 (1,2,1), P2 (4,0,1), P3 (1,1,2), P4 (4,3,1). Granting P1's full need leaves (1,0,0) but P1 can finish, giving (4,2,2), then P2, P3, P4, P0 follow. Each other request leaves an available vector no process's need fits, so it is unsafe.
More Operating Systems questions
- Disk cylinders 0–199; the head is at 50 and the queue holds 82, 170, 43, 140, 24, 16, 190. What is the total head movement under SSTF?
- Disk cylinders 0–199; the head is at 50 moving toward higher cylinders; the queue holds 82, 170, 43, 140, 24, 16, 190. Counting the return…
- How many times is x printed? (Every fork() succeeds, and each print is an unbuffered write, so nothing is printed twice through copied…
- Which values are printed (in some order)? (Every fork() succeeds, and each print is an unbuffered write, so nothing is printed twice…
- How many numbers are printed in total, and what is their sum? (Every fork() succeeds, and each print is an unbuffered write, so nothing is…
- What is the sum of all values printed? (Every fork() succeeds, and each print is an unbuffered write, so nothing is printed twice through…