I have this assignment question but I am a bit unsure how to go about answering it. The question is as follows and accompanied by the image below:
Three processes are competing for six resources labelled A to F as shown below.
Using a resource allocation graph, show the possibility of a deadlock in the implementation above.
I know how to do the graph but what I am struggling to understand is, do I take the Release();
methods into consideration or only the Get();
methods. And also, would P0()
access resources A, B and C first or will each process run simultaneously meaning P0()
access resource A, P1()
access resource D and P2()
access resource C, and then the second set of Get()
methods are requested simultaneously? Lastly it does not specify how many instances (dots) are in each resource, is there any indication as to how to determine/go about working with this? As soon as I can clear up these misunderstandings I can draw the diagram
Asked By : Osiris93
Answered By : Yuval Filmus
Here is one bad scenario:
- P0 obtains A and B.
- P1 obtains D and E.
- P2 obtains C and F.
At this point, we have reached deadlock, since P0 is waiting for P2 to release C, P1 is waiting for P0 to release B, and P2 is waiting P1 to release D.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/45764
0 comments:
Post a Comment
Let us know your responses and feedback