0

Consider a system having m resources of same type and 3 process A,B and C have peak demands of 3,4 and 6 respectiveley.

What should be the value of m such that the deadlock will not occur ?

My Analysis :

If we consider the worst case , 2 for A ,3 for B and 5 for C (2+3+5=10) resources are currently allocated . So in addition to that , one more resource if allocated to any one of the process will prevent the occurance of deadlock.

So , the answer is 11 . Is this correct ? or is there any other answer that contradicts above

3
  • No. You only need two processes to be attempting to lock a resource for deadlock to occur, so in your analysis of the worst case, one of your 3 processes could already have allocated its maximum usage, making the answer 12.
    – Jules
    Jan 28, 2015 at 10:59
  • Can you please explain in detail ? Jan 28, 2015 at 11:02
  • @Jules: Your logic is flawed if there is a third process that can make resources available that are acceptable to either of the waiting processes. Jan 28, 2015 at 14:07

1 Answer 1

1

Given the assumptions that

  • all resources are equally acceptable to each process, and
  • each process gradually allocates resources up to the peak demand before releasing any resources (if not enough resources are available, the process will indefinitely wait for more without releasing any of the current resources), and
  • after finishing, each process releases their resources to be used again by another process

then your analysis is correct and having 11 resources available will avoid deadlocks on the resources.

If there are 10 or fewer resources, then it is possible to allocate the resources in such a way that all processes end up waiting for another process to release their resources.
If you have 11 or 12 resources, then there will always be at least one process that can reach its allocation limit and complete, after which the resources of that process become available again for the others.
If you have 13 or more resources, then all processes can always get enough resources without waiting on each other.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.