0

N processes share M resource units that can be reserved and release only one at a time. The maximum need of each process does not exceed M, and the sum of all maximum needs is less than M+N. Can a deadlock occur in the system ?

Courtney
  • 5
  • 3

2 Answers2

1

the system you are describing looks like semaphores

about your last question : YES. You "could" always do a deadlock ; if you don't see how, ask a young/shameful/motivated/deviant developer.

One good way to make a good one ; is to have strange locking/releasing resources rules. For example, if a process needs M resources to perform a task, he could locks half of them right away, and then waits for the other half to be available before doing anything.

I assume he never gives up until he have its M precious resources and releases them all once the task done.

A single process wouldn't cause much problems but several will as they will lock more than M total resources and will need more of them to get out this frozen state.

vaugham
  • 1,737
  • 17
  • 35
0

I hope you got the answer. Answering this question for other visitors.

The answer is that the deadlock will not occur in the system.

The proof is given in the image below.

The image was taken from http://alumni.cs.ucr.edu/~choua/school/cs153/Solution%20Manual.pdf on page 31

Upperwal
  • 71
  • 7