Bird
Raised Fist0

If a process requests resources that would keep the system in a safe state but the system is currently in an unsafe state, what does the Banker's Algorithm do and why?

hard🎤 Interviewer Follow-up Q15 of Q15
Operating Systems - Banker's Algorithm - Safe State & Resource Allocation
If a process requests resources that would keep the system in a safe state but the system is currently in an unsafe state, what does the Banker's Algorithm do and why?
AIt denies the request because the system must always remain in a safe state, and starting from an unsafe state invalidates the algorithm's assumptions.
BIt restarts the system to reset resource allocations and ensure safety.
CIt preempts resources from other processes to restore a safe state before granting the request.
DIt grants the request because the immediate allocation is safe, ignoring the current unsafe state.
Step-by-Step Solution
  1. Step 1: Recall Banker's Algorithm assumptions

    The algorithm assumes the system starts in a safe state to guarantee deadlock avoidance.
  2. Step 2: Analyze the scenario

    If the system is already unsafe, granting requests--even if individually safe--cannot guarantee overall safety.
  3. Step 3: Evaluate options

    A ignores the unsafe starting state.
    B and C describe actions outside the algorithm's scope.
  4. Final Answer:

    Option A -> Option A
  5. Quick Check:

    Banker's Algorithm cannot recover from unsafe states; it only avoids entering them.
Quick Trick: Banker's Algorithm requires starting safe state to function correctly [OK]
Common Mistakes:
MISTAKES
  • Assuming safe requests can fix unsafe states
  • Believing the algorithm preempts resources
  • Thinking system restarts are part of the algorithm
Trap Explanation:
PITFALL
  • Option A is tempting because the request itself is safe, but the overall system state matters. Options B and C confuse Banker's Algorithm with other recovery mechanisms.
Interviewer Note:
CONTEXT
  • Tests deep understanding of algorithm assumptions and limitations in edge cases.
Master "Banker's Algorithm - Safe State & Resource Allocation" in Operating Systems

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Operating Systems Quizzes