A safe state is a resource-allocation state with an execution schedule that lets every execution complete, even after requesting its maximum resources. An unsafe state lacks such a schedule and risks deadlock. section 11.2.2
The Banker’s algorithm evaluates a requested allocation using:
- Each execution’s maximum possible request. section 11.2.2
- The resources currently held by each execution. section 11.2.2
- The number of resources currently available. section 11.2.2
- Grant a request only when the resulting state remains safe; otherwise suspend the requesting execution. section 11.2.2
Database connection pool
With a fixed pool of database sessions, granting execution a another session can create an unsafe state when the remaining resources cannot satisfy executions a, b, and c. The original allocation remains safe if some completion schedule still exists. section 11.2.2
Compare the safe and unsafe resource-allocation scenarios. section 11.2.2
