Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
World Full Of Questions
This world is full of questions and we will try to answer a few of
them.
Numerical Solved by Banker’s Algorithm
Q2. Consider the table given below for a system,
find the need matrix and the safety sequence, is
the request from process P1(0, 1, 2) can be granted
immediately.
Resource – 3 types
A – (10 instances)
B – (5 instances)
https://worldfullofquestions.wordpress.com/2014/07/14/numericalsolvedbybankersalgorithm/ 1/6
8/17/2016 Numerical Solved by Banker’s Algorithm – World Full Of Questions
C – (7 instances)
https://worldfullofquestions.wordpress.com/2014/07/14/numericalsolvedbybankersalgorithm/ 2/6
8/17/2016 Numerical Solved by Banker’s Algorithm – World Full Of Questions
P0 A B C A B C A B C A B C
P1 0 1 0 7 5 3 3 3 2 7 4 3
P2 2 0 0 3 2 2 1 2 2
P3 3 0 2 9 0 2 6 0 0
P4 2 1 1 2 2 2 0 1 1
0 0 2 4 3 3 4 3 1
Solution: Banker’s Algorithm
Step 1:
Safety for process P0
need0 = (7, 4, 3)
If need0 ≤ Available
if [(7, 4, 3) ≤ (3, 3, 2)] (false)
Process P0 must wait.
Step 2:
https://worldfullofquestions.wordpress.com/2014/07/14/numericalsolvedbybankersalgorithm/ 3/6
8/17/2016 Numerical Solved by Banker’s Algorithm – World Full Of Questions
Step 2:
Safety for process P0
need1 = (1, 2, 2)
if needi ≤ Available
if [(1, 2, 2) ≤ (3, 3, 2)]
Pi will execute.
Available = Available + Allocation
= (3, 3, 2) + (2, 0, 0)
= (5, 3, 2)
Step 3:
Safety for process P2
need2 = (6, 0, 0)
if need2 ≤ Available
if [(6, 0, 0) ≤(5, 3, 2)] (false)
P3 will execute.
Available = Available + Allocation
= (5, 3, 2) + (2, 1, 1)
= (7, 4, 3)
Step 5:
Safety for process P4
need4 = (4, 3, 1)
If need4 ≤ Available
If [(4, 3, 1) ≤ (6, 4, 3)]
P4 will execute.
Available = Available + Allocation
= (7, 4, 3) + (0, 0, 2)
= (7, 4, 5)
Step 6:
Safety for process P0
need = (7, 4, 3)
https://worldfullofquestions.wordpress.com/2014/07/14/numericalsolvedbybankersalgorithm/ 4/6
8/17/2016
0 Numerical Solved by Banker’s Algorithm – World Full Of Questions
if need0 ≤ Available
if [(7, 4, 3) ≤ (7, 4, 5)]
P0 will execute.
Available = Available + Allocation
= (7, 4, 5) + (0, 1, 0)
= (7, 5, 5)
Step 7:
Safety for process P2
need2 = (6, 0, 0)
if need2 ≤ Available
if [(6, 0, 0) ≤ (7, 5, 5)]
P2 will execute.
Available = Available + Allocation
= (7, 5, 5) + (3, 0, 2)
= (10, 5, 7)
Safety Sequence = <P1, P3, P4, P0, P2>
About these ads (https://wordpress.com/abouttheseads/)
ALGORITHM, ALLOCATION, AVAILABLE INSTANCE, BANKER’S, BANKER’S ALGORITHM,
EMBEDDED OPERATING SYSTEM, MAX, MAXIMUM, NEED, NUMBERICAL, NUMERICAL,
NUMERICAL SOLVED BY BANKERʹS ALGORITHM, OPERATING SYSTEM, PROCESS, PROCESS
ALLOCATION, PROCESSES, RESOURCE, RESOURCE TYPE, RESOURCES, SAFETY SEQUENCE
https://worldfullofquestions.wordpress.com/2014/07/14/numericalsolvedbybankersalgorithm/ 5/6
8/17/2016 Numerical Solved by Banker’s Algorithm – World Full Of Questions
One thought on “Numerical Solved by Banker’s Algorithm”
Akshay Patil says:
May 11, 2016 at 6:57 am
1. Awesome explaination of banker’s algorithm..!
Anyone can understand this way..
Thanx a lot..
REPLY
PROUDLY POWERED BY WORDPRESS
https://worldfullofquestions.wordpress.com/2014/07/14/numericalsolvedbybankersalgorithm/ 6/6