Practice mode Operating Systems

Processes P0 to P3 share resources A, B and C. Allocation: P0 (1,0,1), P1 (2,1,1), P2 (1,0,2), P3 (0,1,0). Maximum: P0 (3,2,2), P1 (3,2,2), P2 (2,1,3), P3 (1,2,2). Available: (1,1,1). Which is a safe sequence under the Banker’s algorithm?

Correct answer B. P1, P0, P2, P3

Explanation

Need = Max - Allocation: P0 (2,2,1), P1 (1,1,1), P2 (1,1,1), P3 (1,1,2). P1 fits Available (1,1,1), finishes and frees resources, making (3,2,2); P0 then fits, giving (4,2,3); P2 gives (5,2,5); P3 fits and finishes. Any sequence starting with P0 or P3 fails at once, because their Needs exceed (1,1,1).

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.