SlideShare una empresa de Scribd logo
1 de 18
Understand Process Management

•   Deadlock Detection




                                         1
HOME     PREVIOUS TOPIC
NEXT
PREVIOUS QUESTION PAPERS
FOR OS
CPP TUTORIALS




                           2
Recap

In 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
Objectives


On 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 Detection

The Deadlock detection algorithms in the previous slide
are 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

              P5


R1             R3           R4



P1             P2           P3



R2             P4           R5

          Fig – 1(a)
                                 8
Corresponding Wait-for
 graph

              P5



P1             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
Summary


In 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 Questions

1. Explain Deadlock Detection




                                      15
Quiz


1) --------------------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
•   java

home
Quiz

2) A --------------- exists in the system if and only if
    the wait-for graph contains a cycle
a) Deadlock
b) Request
c) None



                                                           18

Más contenido relacionado

La actualidad más candente

Provenance for Data Munging Environments
Provenance for Data Munging EnvironmentsProvenance for Data Munging Environments
Provenance for Data Munging EnvironmentsPaul Groth
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating systemAli Haider
 
Mca ii os u-3 dead lock & io systems
Mca  ii  os u-3 dead lock & io systemsMca  ii  os u-3 dead lock & io systems
Mca ii os u-3 dead lock & io systemsRai University
 
Dead Lock In Operating Systems
Dead Lock In Operating SystemsDead Lock In Operating Systems
Dead Lock In Operating Systemstotallooser
 
Practical lessons in memory analysis
Practical lessons in memory analysisPractical lessons in memory analysis
Practical lessons in memory analysisAJohnson1
 
Tradeoffs in Automatic Provenance Capture
Tradeoffs in Automatic Provenance CaptureTradeoffs in Automatic Provenance Capture
Tradeoffs in Automatic Provenance CapturePaul Groth
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)Shayek Parvez
 
Decoupling Provenance Capture and Analysis from Execution
Decoupling Provenance Capture and Analysis from ExecutionDecoupling Provenance Capture and Analysis from Execution
Decoupling Provenance Capture and Analysis from ExecutionPaul Groth
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating SystemAUST
 
Operating system Dead lock
Operating system Dead lockOperating system Dead lock
Operating system Dead lockKaram Munir Butt
 

La actualidad más candente (20)

Provenance for Data Munging Environments
Provenance for Data Munging EnvironmentsProvenance for Data Munging Environments
Provenance for Data Munging Environments
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating system
 
Deadlocks
Deadlocks Deadlocks
Deadlocks
 
Deadlock
DeadlockDeadlock
Deadlock
 
Sucet os module_3_notes
Sucet os module_3_notesSucet os module_3_notes
Sucet os module_3_notes
 
Mca ii os u-3 dead lock & io systems
Mca  ii  os u-3 dead lock & io systemsMca  ii  os u-3 dead lock & io systems
Mca ii os u-3 dead lock & io systems
 
Operating system - Deadlock
Operating system - DeadlockOperating system - Deadlock
Operating system - Deadlock
 
Dead Lock In Operating Systems
Dead Lock In Operating SystemsDead Lock In Operating Systems
Dead Lock In Operating Systems
 
Deadlock
DeadlockDeadlock
Deadlock
 
Practical lessons in memory analysis
Practical lessons in memory analysisPractical lessons in memory analysis
Practical lessons in memory analysis
 
Tradeoffs in Automatic Provenance Capture
Tradeoffs in Automatic Provenance CaptureTradeoffs in Automatic Provenance Capture
Tradeoffs in Automatic Provenance Capture
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
 
Decoupling Provenance Capture and Analysis from Execution
Decoupling Provenance Capture and Analysis from ExecutionDecoupling Provenance Capture and Analysis from Execution
Decoupling Provenance Capture and Analysis from Execution
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
 
Operating system Dead lock
Operating system Dead lockOperating system Dead lock
Operating system Dead lock
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
 
Deadlock
DeadlockDeadlock
Deadlock
 

Destacado

c-programming-using-pointers
c-programming-using-pointersc-programming-using-pointers
c-programming-using-pointersSushil Mishra
 
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)Make Mannan
 
Programs for Operating System
Programs for Operating SystemPrograms for Operating System
Programs for Operating SystemLPU
 

Destacado (6)

Deadlock
DeadlockDeadlock
Deadlock
 
c-programming-using-pointers
c-programming-using-pointersc-programming-using-pointers
c-programming-using-pointers
 
Os file
Os fileOs file
Os file
 
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
 
O.s. lab all_experimets
O.s. lab all_experimetsO.s. lab all_experimets
O.s. lab all_experimets
 
Programs for Operating System
Programs for Operating SystemPrograms for Operating System
Programs for Operating System
 

Similar a 28 to 29 detection

Similar a 28 to 29 detection (20)

26 to 27deadlockavoidance
26 to 27deadlockavoidance26 to 27deadlockavoidance
26 to 27deadlockavoidance
 
chapter06-new.pptx
chapter06-new.pptxchapter06-new.pptx
chapter06-new.pptx
 
Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05
 
3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt
 
Deadlocks Part- I.pdf
Deadlocks Part- I.pdfDeadlocks Part- I.pdf
Deadlocks Part- I.pdf
 
OS-Part-06.pdf
OS-Part-06.pdfOS-Part-06.pdf
OS-Part-06.pdf
 
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptxosvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
 
Deadlocks Part- III.pdf
Deadlocks Part- III.pdfDeadlocks Part- III.pdf
Deadlocks Part- III.pdf
 
3 (2).ppt
3 (2).ppt3 (2).ppt
3 (2).ppt
 
Ch07 deadlocks
Ch07 deadlocksCh07 deadlocks
Ch07 deadlocks
 
deadlock part5 unit 2.ppt
deadlock part5 unit 2.pptdeadlock part5 unit 2.ppt
deadlock part5 unit 2.ppt
 
deadlock.ppt
deadlock.pptdeadlock.ppt
deadlock.ppt
 
Deadlock (1).ppt
Deadlock (1).pptDeadlock (1).ppt
Deadlock (1).ppt
 
Chapter06.ppt
Chapter06.pptChapter06.ppt
Chapter06.ppt
 
06-Deadlocks.ppt
06-Deadlocks.ppt06-Deadlocks.ppt
06-Deadlocks.ppt
 
Os5
Os5Os5
Os5
 
Ch7 deadlocks
Ch7   deadlocksCh7   deadlocks
Ch7 deadlocks
 
The Functions of the Operating System
The Functions of the Operating SystemThe Functions of the Operating System
The Functions of the Operating System
 
DeadlockMar21.ppt
DeadlockMar21.pptDeadlockMar21.ppt
DeadlockMar21.ppt
 
OS 7.pptx
OS 7.pptxOS 7.pptx
OS 7.pptx
 

Más de myrajendra (20)

Fundamentals
FundamentalsFundamentals
Fundamentals
 
Data type
Data typeData type
Data type
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1
 
Jdbc workflow
Jdbc workflowJdbc workflow
Jdbc workflow
 
2 jdbc drivers
2 jdbc drivers2 jdbc drivers
2 jdbc drivers
 
3 jdbc api
3 jdbc api3 jdbc api
3 jdbc api
 
4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Dao example
Dao exampleDao example
Dao example
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
Internal
InternalInternal
Internal
 
3. elements
3. elements3. elements
3. elements
 
2. attributes
2. attributes2. attributes
2. attributes
 
1 introduction to html
1 introduction to html1 introduction to html
1 introduction to html
 
Headings
HeadingsHeadings
Headings
 
Forms
FormsForms
Forms
 
Css
CssCss
Css
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Starting jdbc
Starting jdbcStarting jdbc
Starting jdbc
 

28 to 29 detection

  • 1. Understand Process Management • Deadlock Detection 1
  • 2. HOME PREVIOUS TOPIC NEXT PREVIOUS QUESTION PAPERS FOR OS CPP TUTORIALS 2
  • 3. Recap In 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. Objectives On completion of this class, you would be able to know : • Deadlock Detection Techniques 4
  • 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. Deadlock Detection The Deadlock detection algorithms in the previous slide are explained with the following conditions • Single Instance of Each Resource Type • Several Instances of Resource Type 6
  • 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. Resource-Allocation Graph P5 R1 R3 R4 P1 P2 P3 R2 P4 R5 Fig – 1(a) 8
  • 9. Corresponding Wait-for graph P5 P1 P2 P3 P4 Fig – 1(b) 9
  • 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. 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. 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. 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. Summary In 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
  • 15. Frequently Asked Questions 1. Explain Deadlock Detection 15
  • 16. Quiz 1) --------------------An nxm matrix defines the number of resources of each type currently allocated a) Allocation b) Available c )None 16
  • 17. Other subject materials • Web designing • Micro processors • C++ tutorials • java home
  • 18. Quiz 2) A --------------- exists in the system if and only if the wait-for graph contains a cycle a) Deadlock b) Request c) None 18