0% found this document useful (0 votes)
6 views

Bankers Algorithm Solved

The document explains a solved example of the Banker's Algorithm, detailing the total resources, processes, and matrices involved. It outlines the steps to calculate the Need and Available resources, and checks for a safe sequence, concluding that no deadlock was found and a safe execution sequence exists. The safe sequence identified is P1 → P3 → P4 → P2 → P0.

Uploaded by

mmashru426
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Bankers Algorithm Solved

The document explains a solved example of the Banker's Algorithm, detailing the total resources, processes, and matrices involved. It outlines the steps to calculate the Need and Available resources, and checks for a safe sequence, concluding that no deadlock was found and a safe execution sequence exists. The safe sequence identified is P1 → P3 → P4 → P2 → P0.

Uploaded by

mmashru426
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Solved Example of Banker's

Algorithm
Step-by-Step Explanation with
Deadlock Check
Given Data
• Total Resources: A=10, B=5, C=8
• Number of Processes: 5
• Resources: A, B, C
• Matrices: Allocation, Maximum, Need,
Available
Allocation & Maximum Matrices
• P0: Allocation (0,1,0), Maximum (7,5,3)
• P1: Allocation (2,0,0), Maximum (3,2,2)
• P2: Allocation (3,0,2), Maximum (9,0,2)
• P3: Allocation (2,1,1), Maximum (4,3,3)
• P4: Allocation (0,0,2), Maximum (5,2,2)
Step 1 - Calculate Need Matrix
• Need = Maximum - Allocation
• P0: (7-0, 5-1, 3-0) = (7,4,3)
• P1: (3-2, 2-0, 2-0) = (1,2,2)
• P2: (9-3, 0-0, 2-2) = (6,0,0)
• P3: (4-2, 3-1, 3-1) = (2,2,2)
• P4: (5-0, 2-0, 2-2) = (5,2,0)
Step 2 - Calculate Available
Resources
• Available = Total - Sum of Allocated
• Total: (10,5,8)
• Allocated Sum: (7,2,5)
• Available: (10-7, 5-2, 8-5) = (3,3,3)
Step 3 - Check for Safe Sequence
• 1. P1 (1,2,2) ≤ (3,3,3) → P1 executes
• 2. P3 (2,2,2) ≤ (5,3,3) → P3 executes
• 3. P4 (5,2,0) ≤ (7,4,4) → P4 executes
• 4. P2 (6,0,0) ≤ (7,4,6) → P2 executes
• 5. P0 (7,4,3) ≤ (10,4,8) → P0 executes
• Safe Sequence: P1 → P3 → P4 → P2 → P0 ✅
Conclusion
• • No Deadlock Found ✅
• • Safe Sequence Exists
• • Banker's Algorithm Ensures Safe Execution
Thank You!
• Any Questions?

You might also like