No Deadlock

Discussion in 'Homework Help' started by zulfi100, Mar 17, 2013.

  1. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    Hi,
    Can somebody plz guide me with the following question:

    Zulfi.
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,452
    3,371
    Would the answer be 3 x 2 = 6?
     
  3. WBahn

    Moderator

    Mar 31, 2012
    17,788
    4,808
    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.
     
  4. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    Hi,
    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.

    Zulfi.
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,452
    3,371
    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.
     
  6. WBahn

    Moderator

    Mar 31, 2012
    17,788
    4,808
    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.
     
  7. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    Hi,
    Thanks for help on this. I have to consider the dead lock case.

    Zulfi.
     
Loading...