Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
0 of .
Results for:
P. 1

Ratings: (0)|Views: 3 |Likes:

Categories:Types, Research

### Availability:

See more
See less

08/28/2013

pdf

text

original

A state that may lead to deadlock and must be avoided.Safe State

A state that has a scheduling order or a sequence of processes in which every process in thesequence can complete its execution.
Assume that there are three processes and ten resources of the same type. The Table below shows thecurrent resource allocation.Process Maximum needed Currently HoldingP
1
8 1P
2
5 3P
3
9 3
Banker’s Algorithm

Used to determine if the current state of the system is safe or not.Example:A system has 4 processes and 10 resources of the same type. Assume the following resource allocationtable.Process Max[i] hold[i]P
1
6 1P
2
5 1P
3
4 2P
4
7 3The values for the variables are:
Need[1]=6-1=5Need[2]=5-2=4Need[3]=4-2=2Need[4]=7-3+4
Available= 10(1+1+2+3)=3 this is the current state of…..

Now suppose the p4 makes a request for 1 resource. The temporary new state of the system will beProcess Max[i] hold[i]P
1
6 1P
2
5 1P
3
4 2P
4
7 4The values for the variables are:
Need[1]=6-1=5Need[2]=5-1=4Need[3]=4-2=2Need[4]=7-3+4 Available= 10(1+1+2+3)=2this is give state is safe state.
Now suppose the p2 makes a request for 1 resource. The temporary new state of the system will beProcess Max[i] hold[i]P
1
6 1P
2
5 2P
3
4 2P
4
7 4The values for the variables are:
Need[1]=6-1=5Need[2]=5-2=3Need[3]=4-2=2Need[4]=7-3+4 Available= 10(1+1+2+3)=2this is give state is u safe state.