SlideShare a Scribd company logo
1 of 11
Deadlocks
Prepared By: Mr. Sangram A. Patil
Assistant Professor PVPIT,Budhgaon
 Definition
Deadlock is a situation where a set of processes are blocked because each
process is holding a resource and waiting for another resource acquired by some
process.
 Example
 System has 2 disk drives.
 P1 and P2 each hold one disk drive and each needs another one.
 Example
 semaphores A and B, initialized to 1
P0
wait (A);
wait (B);
P1
wait(B)
wait(A)
System Model
 System consists of
1. Finite number of resources shared between number of competing processes.
Resources are partitioned into several types such as CPU cycles, files and IO
devices(printers and drives) .
Each resource type consisting of several instances.
2. process must request a resource before using it and release a resource after using it.
process can request as many as resources required to it to carry out designated
task
number of resource request cannot exceed.
Process request a resource allocation of any instance of resource satisfies the
request.
 Each process utilizes a resource as follows:
 request
 use
 release
Deadlock Characterization
 Deadlock can arise if four conditions hold simultaneously.
1. Mutual exclusion: only one process at a time can use a resource.
2. Hold and wait: a process holding at least one resource is waiting to
acquire additional resources held by other processes.
3. No preemption: resources can not be preempted a resource can be
released only voluntarily by the process holding it, after that process has
completed its task.
4. Circular wait: there exists a set {P0, P1, …, Pn} of waiting processes such
that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource
that is held by P2, …, Pn–1 is waiting for a resource that is held by Pn, and Pn is
waiting for a resource that is held by P0.
Resource-Allocation Graph
 A set of vertices V and a set of edges E.
 V is partitioned into two types:
 P = {P1, P2, …, Pn}, the set consisting of all active processes in the
system.
 R = {R1, R2, …, Rm}, the set consisting of all resource types in the system.
 request edge – directed edge Pi  Rj
 assignment edge – directed edge Rj  Pi
Resource-Allocation Graph (Cont.)
Example of a Resource Allocation Graph
• Consists of sets P,R,E
P={P1,P2,P3}
R= {R1,R2,R3,R4}
E={P1->R1,P2->R3,R1->P2,R2->P2,R2->P1,
R3->P3}
• Resource instances:
• Process states
If graph contains no cycle then no process in the
system is deadlocked
If graph does contain a cycle then deadlock may
exists.
Resource Allocation Graph With A
Deadlock
 Two cycles
P1->R1->P2->R3->P3->R2->P1
P2->R3->P3->R2->P2
Graph With A Cycle But No Deadlock
 There is cycle but no deadlock
P1->R1->P3->R2->P1
Basic Facts
 If graph contains no cycles  no deadlock.
 If graph contains a cycle 
 if only one instance per resource type, then deadlock.
 if several instances per resource type, possibility of deadlock.

More Related Content

What's hot

What's hot (20)

Deadlock
DeadlockDeadlock
Deadlock
 
Ch8 OS
Ch8 OSCh8 OS
Ch8 OS
 
Mch7 deadlock
Mch7 deadlockMch7 deadlock
Mch7 deadlock
 
Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock Galvin
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
 
O ssvv62015
O ssvv62015O ssvv62015
O ssvv62015
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & prevention
 
Bankers
BankersBankers
Bankers
 
Deadlock- System model, resource types, deadlock problem, deadlock characteri...
Deadlock- System model, resource types, deadlock problem, deadlock characteri...Deadlock- System model, resource types, deadlock problem, deadlock characteri...
Deadlock- System model, resource types, deadlock problem, deadlock characteri...
 
Operating system Dead lock
Operating system Dead lockOperating system Dead lock
Operating system Dead lock
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
 
7 Deadlocks
7 Deadlocks7 Deadlocks
7 Deadlocks
 
Deadlock
DeadlockDeadlock
Deadlock
 
OS_Ch8
OS_Ch8OS_Ch8
OS_Ch8
 
Ch7 deadlocks
Ch7   deadlocksCh7   deadlocks
Ch7 deadlocks
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
 
Os deadlock
Os deadlockOs deadlock
Os deadlock
 
Deadlock and memory management -- Operating System
Deadlock and memory management -- Operating SystemDeadlock and memory management -- Operating System
Deadlock and memory management -- Operating System
 

Similar to Deadlock

Similar to Deadlock (20)

Chapter 5(five).pdf
Chapter 5(five).pdfChapter 5(five).pdf
Chapter 5(five).pdf
 
CH07.pdf
CH07.pdfCH07.pdf
CH07.pdf
 
Module-2Deadlock.ppt
Module-2Deadlock.pptModule-2Deadlock.ppt
Module-2Deadlock.ppt
 
OSLec14&15(Deadlocksinopratingsystem).pptx
OSLec14&15(Deadlocksinopratingsystem).pptxOSLec14&15(Deadlocksinopratingsystem).pptx
OSLec14&15(Deadlocksinopratingsystem).pptx
 
14th November - Deadlock Prevention, Avoidance.ppt
14th November - Deadlock Prevention, Avoidance.ppt14th November - Deadlock Prevention, Avoidance.ppt
14th November - Deadlock Prevention, Avoidance.ppt
 
deadlock in OS.pptx
deadlock in OS.pptxdeadlock in OS.pptx
deadlock in OS.pptx
 
Deadlock in Real Time operating Systempptx
Deadlock in Real Time operating SystempptxDeadlock in Real Time operating Systempptx
Deadlock in Real Time operating Systempptx
 
Os5
Os5Os5
Os5
 
Ch07 deadlocks
Ch07 deadlocksCh07 deadlocks
Ch07 deadlocks
 
Module 3 Deadlocks.pptx
Module 3 Deadlocks.pptxModule 3 Deadlocks.pptx
Module 3 Deadlocks.pptx
 
Deadlock.ppt
Deadlock.pptDeadlock.ppt
Deadlock.ppt
 
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
 
deadlocks.pptx
deadlocks.pptxdeadlocks.pptx
deadlocks.pptx
 
Os unit 4
Os unit 4Os unit 4
Os unit 4
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
deadlock part5 unit 2.ppt
deadlock part5 unit 2.pptdeadlock part5 unit 2.ppt
deadlock part5 unit 2.ppt
 
Sucet os module_3_notes
Sucet os module_3_notesSucet os module_3_notes
Sucet os module_3_notes
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
10. deadlock
10. deadlock10. deadlock
10. deadlock
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 

More from sangrampatil81

More from sangrampatil81 (20)

Memory Management
Memory ManagementMemory Management
Memory Management
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
IO hardware
IO hardwareIO hardware
IO hardware
 
File system structure
File system structureFile system structure
File system structure
 
File management
File managementFile management
File management
 
Disk structure
Disk structureDisk structure
Disk structure
 
Directory structure
Directory structureDirectory structure
Directory structure
 
Directory implementation and allocation methods
Directory implementation and allocation methodsDirectory implementation and allocation methods
Directory implementation and allocation methods
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
Semaphore
SemaphoreSemaphore
Semaphore
 
Monitors
MonitorsMonitors
Monitors
 
Classical problems of process synchronization
Classical problems of process synchronizationClassical problems of process synchronization
Classical problems of process synchronization
 
System programs
System programsSystem programs
System programs
 
System programs
System programsSystem programs
System programs
 
Services and system calls
Services and system callsServices and system calls
Services and system calls
 
Operating system structure
Operating system structureOperating system structure
Operating system structure
 
Operating system deign and implementation
Operating system deign and implementationOperating system deign and implementation
Operating system deign and implementation
 
Pointer to array and structure
Pointer to array and structurePointer to array and structure
Pointer to array and structure
 
Pointer arithmetic in c
Pointer arithmetic in c Pointer arithmetic in c
Pointer arithmetic in c
 
Pointer in c
Pointer in c Pointer in c
Pointer in c
 

Recently uploaded

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 

Recently uploaded (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 

Deadlock

  • 1. Deadlocks Prepared By: Mr. Sangram A. Patil Assistant Professor PVPIT,Budhgaon
  • 2.  Definition Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some process.  Example  System has 2 disk drives.  P1 and P2 each hold one disk drive and each needs another one.  Example  semaphores A and B, initialized to 1 P0 wait (A); wait (B); P1 wait(B) wait(A)
  • 3. System Model  System consists of 1. Finite number of resources shared between number of competing processes. Resources are partitioned into several types such as CPU cycles, files and IO devices(printers and drives) . Each resource type consisting of several instances. 2. process must request a resource before using it and release a resource after using it. process can request as many as resources required to it to carry out designated task number of resource request cannot exceed. Process request a resource allocation of any instance of resource satisfies the request.
  • 4.  Each process utilizes a resource as follows:  request  use  release
  • 5. Deadlock Characterization  Deadlock can arise if four conditions hold simultaneously. 1. Mutual exclusion: only one process at a time can use a resource. 2. Hold and wait: a process holding at least one resource is waiting to acquire additional resources held by other processes. 3. No preemption: resources can not be preempted a resource can be released only voluntarily by the process holding it, after that process has completed its task. 4. Circular wait: there exists a set {P0, P1, …, Pn} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, …, Pn–1 is waiting for a resource that is held by Pn, and Pn is waiting for a resource that is held by P0.
  • 6. Resource-Allocation Graph  A set of vertices V and a set of edges E.  V is partitioned into two types:  P = {P1, P2, …, Pn}, the set consisting of all active processes in the system.  R = {R1, R2, …, Rm}, the set consisting of all resource types in the system.  request edge – directed edge Pi  Rj  assignment edge – directed edge Rj  Pi
  • 8. Example of a Resource Allocation Graph • Consists of sets P,R,E P={P1,P2,P3} R= {R1,R2,R3,R4} E={P1->R1,P2->R3,R1->P2,R2->P2,R2->P1, R3->P3} • Resource instances: • Process states If graph contains no cycle then no process in the system is deadlocked If graph does contain a cycle then deadlock may exists.
  • 9. Resource Allocation Graph With A Deadlock  Two cycles P1->R1->P2->R3->P3->R2->P1 P2->R3->P3->R2->P2
  • 10. Graph With A Cycle But No Deadlock  There is cycle but no deadlock P1->R1->P3->R2->P1
  • 11. Basic Facts  If graph contains no cycles  no deadlock.  If graph contains a cycle   if only one instance per resource type, then deadlock.  if several instances per resource type, possibility of deadlock.