Bölüm 7 · Simülatör

Banker’s Algorithm

← Bölüm 7
Speed 1/s
Scenario
Processes 5
Resources 3

Step 0/0 ✓ Finished 0/0 State –

Banker’s Algorithm

The banker’s algorithm avoids deadlock: before a request is granted, the system checks that the resulting state is still safe, i.e. that some order lets every process obtain its maximum claim and finish. The matrices show Allocation, Max and Need = Max − Allocation for every process; Available and the Work vector are shown above them, the safe sequence below.

How to use

  • Safety check runs the safety algorithm step by step. Allocation, Max and Available cells can be edited (whole numbers 0–99).
  • Request: choose a process, type a request vector and press Check ▶ to run the resource-request algorithm; a granted request is kept in the state.
  • Scenario loads an example; Processes and Resources (1–10 each) resize the matrices.
  • What-if shows, for every process and resource, what would happen to a request of one unit; click a cell to animate that request.
  • ▶ plays; the step buttons move one step back or forward, or jump to the start or end.

Terms

Need
Max − Allocation
Work
Starts as Available; a finishing process returns its Allocation.
Safe
Some order lets every process finish.
Unsafe
No such order; deadlock is possible, not certain.
Scan
P0, P1, … in order; passes repeat until no progress.
Request
≤ Need, else error. ≤ Available, else wait. Pretend to allocate; keep only if safe.

Legend

darker = larger value ✓ fits ✗ too large changed finished

Keys

←→ stepSpace playHomeEndEsc close