Discussion in 'Homework Help' started by zulfi100, Mar 17, 2013.
Can somebody plz guide me with the following question:
Would the answer be 3 x 2 = 6?
Describe the largest number of resource units that could be in use and still have deadlock. You only need one more than that.
Now consider that if ANY unit has two units, then it is not blocked.
Thanks for your comments. I dont know how the resources are allocated. If we have only one resource, no process can run, this may be the deadlock case. If we have 2 resources and one process can run while other two can wait. This may not result in deadlock? Kindly guide me.
I'm not an expert on this but just working through the logic intuitively.
Suppose we define a deadlock as when a user requires 1 more unit and no one releases a unit.
Hence there would be a deadlock if all 3 users have tied up 1 resource each and are waiting for 1 more available resource.
So by this logic you would need 4 units of resources.
A key point to understand is that the point of avoiding deadlock isn't in determining what is required in order to be sure that it is possible that deadlock might not happen, but rather to determine what is required in order to guarantee that it will not happen.
MrChips hit it right on the nose. That's the correct logic and the correct answer.
As long as one user is guaranteed to be able to get the resources they need to run, you can't have deadlock. So the minimum number of resources you need, short of having better allocation strategies, is when all of the resources have almost what they would need and then one more to guarantee that one of them will get the last thing they need.
Thanks for help on this. I have to consider the dead lock case.