The Gateway to Computer Science Excellence
0 votes
29 views

in Operating System by Active (5k points)
retagged by | 29 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

+1 vote
2 answers
1
asked Oct 23, 2018 in Linear Algebra by Balaji Jegan Active (5k points) | 99 views
0 votes
0 answers
3
asked Oct 24, 2018 in Operating System by Balaji Jegan Active (5k points) | 49 views
+1 vote
1 answer
4
asked Oct 23, 2018 in Operating System by Balaji Jegan Active (5k points) | 31 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,324 answers
198,408 comments
105,174 users