Banker's Algorithm | OS Interview | Skill-Lync Resources
Hard Operating Systems Deadlocks

Explain the Banker's algorithm for deadlock avoidance.

Answer

Banker's algorithm determines if resource allocation leaves system in safe state (sequence exists where all processes can complete). Data structures: Available (resources free), Max (maximum needs), Allocation (currently held), Need (Max-Allocation). Safety check: find process whose Need <= Available, simulate completion (Available += Allocation), repeat until all complete (safe) or stuck (unsafe). On request, tentatively allocate, check safety, grant if safe else wait. O(n^2*m) complexity.

Master These Concepts with IIT Certification
IIT Certified

Master These Concepts with IIT Certification

175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.

Relevant for Roles

Senior Software Engineer Systems Developer OS Developer