Upcoming SlideShare
×

# 28 to 29 detection

335 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
335
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
9
0
Likes
0
Embeds 0
No embeds

No notes for slide

### 28 to 29 detection

1. 1. Understand Process Management• Deadlock Detection 1
2. 2. HOME PREVIOUS TOPICNEXTPREVIOUS QUESTION PAPERSFOR OSCPP TUTORIALS 2
3. 3. RecapIn the last class, you have learnt:• Deadlock Avoidance• Safe State and Safe sequence• Banker’s Algorithm• Data Structures needed for implementing Banker’s Algorithm 3
4. 4. ObjectivesOn completion of this class, you would be able to know :• Deadlock Detection Techniques 4
5. 5. Deadlock Detection• Deadlock may occur if a system does not employ – Deadlock prevention – Deadlock avoidance• In this environment the system must provide – An algorithm that examines the state of the system to determine whether a deadlock has occurred – An algorithm to recover from the deadlock 5
6. 6. Deadlock DetectionThe Deadlock detection algorithms in the previous slideare explained with the following conditions• Single Instance of Each Resource Type• Several Instances of Resource Type 6
7. 7. Single Instance of each Resource Type• If all resources have only a single instance, then we can define a Deadlock detection algorithm i.e., – A variant of resource allocation graph – This graph is known as wait-for graph• A deadlock exists in the system if and only if the wait-for graph contains a cycle 7
8. 8. Resource-Allocation Graph P5R1 R3 R4P1 P2 P3R2 P4 R5 Fig – 1(a) 8
9. 9. Corresponding Wait-for graph P5P1 P2 P3 P4 Fig – 1(b) 9
10. 10. Several Instances of a Resource type• The wait-for graph scheme is not applicable to a resource-allocation system with multiple instances of each resource• The Deadlock-detection algorithm contains several time-varying data structures. Namely – Available – Allocation – Request 10
11. 11. Several Instances of a Resource Type• Available: A vector of length m indicates the number of available resources of each type• Allocation: An nxm matrix defines the number of resources of each type currently allocated• Request: An nxm matrix indicates the current request of each process 11
12. 12. Detection-Algorithm Usage• When should we invoke the detection algorithm?The answer depends on – How often is a deadlock likely to occur? – How many process will be affected by deadlock when it happens? 12
13. 13. Detection-Algorithm Usage• Deadlocks occur only when some process makes a request that cannot be granted immediately• If the deadlock occurs frequently, – The detection algorithm should be invoked frequently or – Invoked for every resource request• The above methods incur overhead in computation time• So an alternative method is – To invoke the algorithm at less frequent intervals for Ex. Once per hour 13
14. 14. SummaryIn this class, you have learnt• Deadlock detection under different condition namely• Systems with single instance of each resource type• Several instance of a resource type 14