Question: Consider four binary semaphores, ( mathrm { U } , mathrm { V } , mathrm { W } )

Consider four binary semaphores, \(\mathrm{U},\mathrm{V},\mathrm{W}\), and X . They all were initially set to 1. Consider also four threads, \(\mathrm{T}_{1},\mathrm{~T}_{2},\mathrm{~T}_{3}\), and \(\mathrm{T}_{4}\), executing the following sequences of code (moving downward). Currently, they have reached the inside of the functions which the arrows point to.
1.[6 points] We use Resource Allocation Graph (RAG) to model this problem: each semaphore represents a single-unit resource, and the sem_wait() and sem post() operations represent resource requests and resource releases, respectively. Recall that the RAG changes as the time goes by. All four threads currently have reached the inside of the functions which the arrows point to. Draw the up-to-date RAG at the current situation.
2.[2 points] Based on the RAG from above, some threads are stuck in deadlock. List all such threads.
3.[3 points] Propose a deadlock avoidance solution on how to avoid the above deadlock. Hint: follow the example of printer and plotter in class to find the positions like T to decide whether it should delay the request.
Consider four binary semaphores, \ ( \ mathrm { U

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!