CS FundamentalsHardCapgemini · Cognizant GenC
Banker's algorithm: Available = (3, 3, 2). Allocation / Max for (A, B, C): P0 (0,1,0)/(7,5,3), P1 (2,0,0)/(3,2,2), P2 (3,0,2)/(9,0,2), P3 (2,1,1)/(2,2,2), P4 (0,0,2)/(4,3,3). Which of the following is a safe sequence?
- A. P0, P1, P2, P3, P4
- B. P2, P1, P3, P4, P0
- C. P4, P3, P2, P1, P0
- D. P1, P3, P4, P0, P2
Correct answer: D. P1, P3, P4, P0, P2
Need = Max - Allocation. P1 needs (1,2,2) <= (3,3,2); then Available (5,3,2); P3 needs (0,1,1); then (7,4,3); P4 needs (4,3,1); then (7,4,5); P0 needs (7,4,3); then (7,5,5); P2 needs (6,0,0). P0 first fails since (7,4,3) > (3,3,2); P2 first fails; P4 first fails.
More Operating Systems questions
- A system uses a two-level page table. A TLB lookup takes 10 ns, a memory access takes 100 ns and the TLB hit ratio is 80%. On a TLB miss…
- The reference string 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 is run under FIFO replacement first with 3 frames and then with 4 frames (all…
- The head is at cylinder 50 moving towards higher cylinders, and the queue is 82, 170, 43, 140, 24, 16, 190. What is the total head…
- Free partitions in memory order are 100, 500, 200, 300 and 600 KB. Processes of 212, 417, 112 and 426 KB arrive in that order. Which…
- A spinlock is built with an atomic test-and-set instruction. Which property does the plain version of this lock NOT guarantee?
- How many processes (including the original one) exist after this program runs to completion? c fork(); if (fork()) { fork(); }