CS FundamentalsVery hardGATE CS (PYQ pattern)
A system has R identical units of one resource. Four processes need at most 3, 4, 2 and 5 units. Each process requests units TWO at a time (granted atomically or not at all), except that its final request is for 1 unit when only 1 more is needed; it holds what it has while waiting and releases everything when done. What is the largest R for which a deadlock is still possible?
- A. 10
- B. 8
- C. 9
- D. 7
Correct answer: B. 8
A deadlock needs every unfinished process blocked: its next request (2, or 1 if one unit short) exceeds the free units. Max holdings while unfinished are 2, 2, 0, 4 (sum 8). With all of them held, the 3- and 5-unit processes need only 1 more, so free must be 0: R = 8. To leave 1 unit free, no process may be one short, which caps holdings at 0, 2, 0, 2 = 4 (R = 5). So deadlock is possible up to R = 8; the one-unit-at-a-time formula sum(m - 1) = 10 does not apply here.
More Operating Systems questions
- Banker's algorithm: 5 processes, resource types A, B, C with totals (10, 5, 7). Allocation / Maximum: P0 (0,1,0)/(7,5,3), P1…
- A disk has cylinders 0 to 199. The head is at cylinder 60 moving upward. Pending requests: 18, 150, 72, 41, 177, 95, 33, 124. C-LOOK…
- FIFO page replacement is run on the reference string 3, 4, 2, 6, 1, 3, 4, 6, 7, 1, 1, 5, 3, 4, 7, 2, 1, 7 with an initially empty memory…
- The clock (second-chance) algorithm manages 4 frames, initially empty and filled in order 0..3. A page's reference bit is set to 1 when it…
- Assume every fork() succeeds and each printf output is flushed immediately. int main(void) { for (int i = 0; i < 4; i++) { if (fork() ==…
- A Unix-style file system has 1 KB blocks, 4-byte block pointers and inodes with 12 direct, one single-indirect and one double-indirect…