Upcoming SlideShare
Loading in...5
×

Like this presentation? Why not share!

# 28 to 29 detection

## on Jan 16, 2013

• 452 views

### Views

Total Views
452
Views on SlideShare
444
Embed Views
8

Likes
0
Downloads
4
Comments
0

### 2 Embeds8

 http://raj-os.blogspot.in 7 http://raj-os.blogspot.kr 1

Uploaded via

### Usage Rights

© All Rights Reserved

### Report content

• Comment goes here.
Are you sure you want to
Your message goes here
Edit your comment

## 28 to 29 detection Presentation Transcript

• Understand Process Management• Deadlock Detection 1
• HOME PREVIOUS TOPICNEXTPREVIOUS QUESTION PAPERSFOR OSCPP TUTORIALS 2
• 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
• ObjectivesOn completion of this class, you would be able to know :• Deadlock Detection Techniques 4
• 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
• 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
• 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
• Resource-Allocation Graph P5R1 R3 R4P1 P2 P3R2 P4 R5 Fig – 1(a) 8
• Corresponding Wait-for graph P5P1 P2 P3 P4 Fig – 1(b) 9
• 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
• 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
• 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
• 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
• 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
• Frequently Asked Questions1. Explain Deadlock Detection 15
• Quiz1) --------------------An nxm matrix defines the number of resources of each type currently allocated a) Allocation b) Available c )None 16
• Other subject materials• Web designing• Micro processors• C++ tutorials• javahome
• Quiz2) A --------------- exists in the system if and only if the wait-for graph contains a cyclea) Deadlockb) Requestc) None 18