Scientific Converters Precise unit conversions for science & engineering.

    Loading…

    Banker’s Algorithm Calculator

    The safety algorithm finishes processes whose needs fit what is free: Silberschatz’s example is safe, sequence ⟨P1, P3, P4, P0, P2⟩.

    State

    safe, sequence ⟨P1, P3, P4, P0, P2⟩

    Total resources
    10 5 7
    Need = Max − Allocation
    ProcessAllocationMaxNeed
    P00 1 07 5 37 4 3
    P12 0 03 2 21 2 2
    P23 0 29 0 26 0 0
    P32 1 12 2 20 1 1
    P40 0 24 3 34 3 1
    Step-by-step solution
    1. Work = Available = [3 3 2]; repeatedly pick a process whose Need ≤ Work and release its allocation
    2. P1: need [1 2 2] ≤ work → work = [5 3 2]
    3. P3: need [0 1 1] ≤ work → work = [7 4 3]
    4. P4: need [4 3 1] ≤ work → work = [7 4 5]
    5. P0: need [7 4 3] ≤ work → work = [7 5 5]
    6. P2: need [6 0 0] ≤ work → work = [10 5 7]

    Banker’s Algorithm Formula

    Need = Max − Allocation; run Pᵢ if Needᵢ ≤ Work

    then Work = Work + Allocationᵢ

    Worked Example

    Silberschatz’s five processes and three resource types with Available (3, 3, 2):

    1. Work = Available = [3 3 2]; repeatedly pick a process whose Need ≤ Work and release its allocation
    2. P1: need [1 2 2] ≤ work → work = [5 3 2]
    3. P3: need [0 1 1] ≤ work → work = [7 4 3]
    4. P4: need [4 3 1] ≤ work → work = [7 4 5]
    5. P0: need [7 4 3] ≤ work → work = [7 5 5]
    6. P2: need [6 0 0] ≤ work → work = [10 5 7]
    Need = Max − Allocation
    ProcessAllocationMaxNeed
    P00 1 07 5 37 4 3
    P12 0 03 2 21 2 2
    P23 0 29 0 26 0 0
    P32 1 12 2 20 1 1
    P40 0 24 3 34 3 1

    GATE tip

    For a resource-request question, subtract the request from Available and Need, add it to Allocation, then run the safety check on the new state.

    More Operating Systems Calculators

    Frequently asked questions

    Does an unsafe state mean deadlock?

    No. An unsafe state may lead to deadlock; the Banker’s algorithm avoids it by refusing requests that would leave the system unsafe.

    Can there be more than one safe sequence?

    Yes. This calculator scans processes in order each pass, giving one valid sequence; others may exist.

    Sources

    Last reviewed: . Factors are stored exactly and computed with 50-digit decimal arithmetic. See how we verify conversion factors.

    Cite this page

    APA

    Scientific Converters. (2026, October 15). Banker’s Algorithm Calculator. Retrieved October 25, 2026, from https://scientificconverters.com/calculators/bankers-algorithm-calculator/

    IEEE

    Scientific Converters, "Banker’s Algorithm Calculator," scientificconverters.com. Accessed: Oct. 25, 2026. [Online]. Available: https://scientificconverters.com/calculators/bankers-algorithm-calculator/

    Send feedback

    Found a wrong value, a missing unit or an idea? Tell us. We read every message.

    What is it about?

    We store your message, the page you were on and your email if given. See the privacy policy.