search
Log In
0 votes
51 views

in Operating System
retagged by
51 views
0
2. Its unsafe state i guess, because haven't got into deadlock yet.
0
Process

Max Need

Current Allocation Need Available=Total-∑(Current Allocation)
P1 10 5 5 12-(10)=2
P2 4 2 2  
P3 9 3 6  

 

P2's need can be satisfied by the available resources.

After P2 finishes it will release all its resources that it previously held. Now available will be 2+2=4.

With these 4 resources neither of P1 nor P2's Need can be satisfied. This system will be in unsafe state.

Why not deadlock?

To answer that first we should know what actually does Max Need mean. It is the maximum no. of resources that a process might need. It doesn't mean that the process will need all those "max need" no. of resources for all the time. Maybe process P0 currently needs only 5 resources and doesn't want another 5 at this moment. 

  Just think that if all the processes needed their respective Max need resources to complete execution at t1 then why is the OS not allocating all the 4 instances to P2 only or 10 resources to P1 or 9 resources to P3 at once? Why is it allocating in parts? This is because the processes have requested for resources in that manner. This implies that the processes do not need the max no. of resources at all instances.

Had that been the case then it would lead to deadlock.

Here a situation might arise when P1 and P3 request for 5 and 6 resources respectively. In that case deadlock will arise. But we cannot guarantee that they will surely make such requests. It is one of the possibilities. It might also happen that P3 releases some resources after some time. Then those can be allocated to P3 if it requests.

Since there is always a chance of deadlock we say that it is unsafe. If we had been sure that deadlock will definitely occur then answer would have been C).

My understandings are based on :

https://cs.stackexchange.com/questions/55432/confusion-in-bankers-algorithm-how-resources-are-allocated

https://cs.stackexchange.com/questions/45145/why-unsafe-state-not-always-cause-deadlock

Please log in or register to answer this question.

Related questions

0 votes
1 answer
1
280 views
Railway reservation system currently operational in India can be classified as a 1) batch processing system 2) real time system 3) online system 4) expert system
asked Oct 24, 2018 in Operating System Balaji Jegan 280 views
0 votes
0 answers
2
108 views asked Oct 24, 2018 in Operating System Balaji Jegan 108 views
1 vote
2 answers
3
271 views asked Oct 23, 2018 in Linear Algebra Balaji Jegan 271 views
1 vote
1 answer
4
45 views asked Oct 23, 2018 in Operating System Balaji Jegan 45 views
...