CS FundamentalsVery hardGATE CS
Banker's algorithm, resources (A, B, C). Allocation / Max: P0 (1,0,1) / (4,3,2), P1 (2,1,0) / (3,2,2), P2 (0,1,1) / (2,3,3), P3 (1,1,0) / (1,4,1), P4 (0,0,2) / (2,1,3). Available = (1, 3, 1). Which single request can be granted immediately?
- A. P0 requests (1, 1, 0)
- B. P1 requests (1, 0, 1)
- C. P3 requests (0, 2, 0)
- D. P4 requests (1, 0, 1)
Correct answer: C. P3 requests (0, 2, 0)
Granting P3 (0,2,0) leaves (1,1,1); P3's remaining need (0,1,1) fits, and P3, P4, P1, P2, P0 then finish in turn, so it is safe. The other three requests fit in Available, but after granting each no process can finish: the resulting state is unsafe.
More Operating Systems questions
- Deadlock detection, resources (A, B, C), Available = (1, 0, 0). Allocation / Request: P1 (0,1,0) / (1,0,0), P2 (1,0,1) / (0,2,0), P3…
- Four processes need at most 3, 4, 5 and 2 units of one resource type and request them one at a time in any order. What is the smallest…
- Semaphores s = 0 and t = 0. P1: print A; signal(s); wait(t); print B. P2: wait(s); print C; signal(t); wait(s); print D. P3: print E…
- How many processes exist at the end, including the original? (Every fork() succeeds.) c fork() && (fork() || fork()); fork();
- f.txt does not exist at the start. Program X: fd = open("f.txt", OWRONLY|OCREAT, 0644); then fork(); the child writes "cd" and exits; the…
- Cylinders 0–299; the head is at 140 and moving toward higher numbers. Requests: 45, 210, 160, 12, 275, 98, 130, 190. Which of SSTF and…