Deadlock detection algorithm: Check if the following system is deadlocked and show why?
Added by Rebecca H.
Step 1
Here’s a step-by-step approach to check for deadlock: ** Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 98 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Question 27 (15 points) Recall that the deadlock detection algorithm has the following pseudo-code (where m is the number of resources and n is the number of processes): 1. Mark each process that has a row in the Allocation matrix of all zeros. 2. Initialize a temporary vector W to equal the Available vector V. 3. Find an index i such that process i is currently unmarked and the ith row of Q is less than or equal to W. That is, Qik ≤ Wk for 1 ≤ k ≤ m. If no such row is found, terminate the algorithm. 4. If such a row is found, mark process i and add the corresponding row of the allocation matrix to W. That is, set Wk = Wk + Aik for 1 ≤ k ≤ m. Return to step 3. In this problem, you are to run the deadlock detection algorithm on the system state given in the previous problem. From your graph, you should already be able to tell if the system has a deadlock or not (though one hint, there are 2 of R1 in the system so be careful). We have not given you the available vector V, but you should be able to determine what the current available vector is (it is simply the total number of resources R minus those that have been allocated to processes, shown in A). Perform the deadlock detection algorithm by hand. Perform the steps (a)-(d) (looping back to c if/when needed). At the end, state your conclusion (deadlock or no deadlock) and why you reached your conclusion. Compare your conclusion to the information you should have gotten from the resource allocation graph in question 1.
Akash M.
Consider four processes, P1, P2, P3, P4. They are synchronized using four mutex locks as follows: wait(m[i]); wait(m[(i+1) % 4]); # Critical Section release(m[i]); release(m[(i+1) % 4]); Which of the following conditions of a deadlock are met for the above synchronization?
Mauya M.
What are the conditions that lead to a deadlock?
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD