SlideShare a Scribd company logo
1 of 21
Chapter 6
Concurrency: Deadlock and
Starvation
Deadlock
• Permanent blocking of a set of processes that
either compete for system resources or
communicate with each other
• No efficient solution
• Involve conflicting needs for resources by two or
more processes
Reusable Resources
• Used by only one process at a time and not
depleted by that use
• Processes obtain resources that they later
release for reuse by other processes
• Processors, I/O channels, main and secondary
memory, devices, and data structures such as
files, databases, and semaphores
• Deadlock occurs if each process holds one
resource and requests the other
Reusable Resources
• Space is available for allocation of 200Kbytes,
and the following sequence of events occur
• Deadlock occurs if both processes progress to
their second request
P1
. . .
. . .
Request 80 Kbytes;
Request 60 Kbytes;
P2
. . .
. . .
Request 70 Kbytes;
Request 80 Kbytes;
Consumable Resources
• Created (produced) and destroyed (consumed)
• Interrupts, signals, messages, and information in
I/O buffers
• Deadlock may occur if a Receive message is
blocking
• May take a rare combination of events to cause
deadlock
Example of Deadlock
• Deadlock occurs if receives blocking
P1
. . .
. . .
Receive(P2);
Send(P2, M1);
P2
. . .
. . .
Receive(P1);
Send(P1, M2);
Conditions for Deadlock
• Mutual exclusion
– Only one process may use a resource at a time
• Hold-and-wait
– A process may hold allocated resources while
awaiting assignment of others
Conditions for Deadlock
• No preemption
– No resource can be forcibly removed form a process
holding it
• Circular wait
– A closed chain of processes exists, such that each
process holds at least one resource needed by the
next process in the chain
Possibility of Deadlock
• Mutual Exclusion
• No preemption
• Hold and wait
Existence of Deadlock
• Mutual Exclusion
• No preemption
• Hold and wait
• Circular wait
Deadlock Prevention
• Mutual Exclusion
– Must be supported by the OS
• Hold and Wait
– Require a process request all of its required
resources at one time
Deadlock Prevention
• No Preemption
– Process must release resource and request again
– OS may preempt a process to require it releases its
resources
• Circular Wait
– Define a linear ordering of resource types
Deadlock Avoidance
• A decision is made dynamically whether the
current resource allocation request will, if
granted, potentially lead to a deadlock
• Requires knowledge of future process requests
Two Approaches to
Deadlock Avoidance
• Do not start a process if its demands might lead
to deadlock
• Do not grant an incremental resource request to
a process if this allocation might lead to
deadlock
Resource Allocation Denial
• Referred to as the banker’s algorithm
• State of the system is the current allocation of resources
to process
• Safe state is where there is at least one sequence that
does not result in deadlock
• Unsafe state is a state that is not safe
• Assume we have 9 tape drives. Consider whether or not the above states
are safe or unsafe.
• Since only 7 (3+4) tape drives are currently on loan (allocated), two (2) tape
drives are still available.
• Process B can finish with only two additional tape drives.
• Once Process B is done, it will release all 5 tape drives, making the number
of available tape drives = 5.
• With only three of these tape drives, either Process A or
Process C may complete and release its tape drives.
• This means that there are two possible safe sequences:
<Process B, Process A, Process C> and <Process B,
Process C, Process A>.
• Thus, we say that this is a safe state.
The Banker's Algorithm
• Allows:
– mutual exclusion
– wait and hold
– no preemption
• Prevents:
– circular wait
• System grants request only if the request will result in a
safe state.
Strategies Once Deadlock
Detected
• Abort all deadlocked processes
• Back up each deadlocked process to some
previously defined checkpoint, and restart all
process
– Original deadlock may occur
Strategies Once Deadlock
Detected
• Successively abort deadlocked processes until
deadlock no longer exists
• Successively preempt resources until deadlock
no longer exists
Dining Philosophers Problem

More Related Content

Similar to deadlock and starvation resources allocation.pptx

7308346-Deadlock.pptx
7308346-Deadlock.pptx7308346-Deadlock.pptx
7308346-Deadlock.pptxsheraz7288
 
6. Deadlock_1640227623705.pptx
6. Deadlock_1640227623705.pptx6. Deadlock_1640227623705.pptx
6. Deadlock_1640227623705.pptxshrijanasharma3
 
3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptxsvulasal
 
3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].pptamadayshwan
 
Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Cahyo Darujati
 
The Functions of the Operating System
The Functions of the Operating SystemThe Functions of the Operating System
The Functions of the Operating Systemandyr91
 
Process Scheduling
Process SchedulingProcess Scheduling
Process SchedulingSanthi thi
 
Lecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptxLecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptxAmanuelmergia
 
Os case study word
Os case study wordOs case study word
Os case study wordDhol Yash
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)WajeehaBaig
 
Lecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptxLecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptxAmanuelmergia
 

Similar to deadlock and starvation resources allocation.pptx (20)

Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
3 (2).ppt
3 (2).ppt3 (2).ppt
3 (2).ppt
 
7308346-Deadlock.pptx
7308346-Deadlock.pptx7308346-Deadlock.pptx
7308346-Deadlock.pptx
 
6. Deadlock_1640227623705.pptx
6. Deadlock_1640227623705.pptx6. Deadlock_1640227623705.pptx
6. Deadlock_1640227623705.pptx
 
3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx
 
Distributed Deadlock Detection.ppt
Distributed Deadlock Detection.pptDistributed Deadlock Detection.ppt
Distributed Deadlock Detection.ppt
 
3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt
 
Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05
 
The Functions of the Operating System
The Functions of the Operating SystemThe Functions of the Operating System
The Functions of the Operating System
 
OS-Part-06.pdf
OS-Part-06.pdfOS-Part-06.pdf
OS-Part-06.pdf
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Lecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptxLecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptx
 
Os case study word
Os case study wordOs case study word
Os case study word
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
 
DeadlockMar21.ppt
DeadlockMar21.pptDeadlockMar21.ppt
DeadlockMar21.ppt
 
Ch07 deadlocks
Ch07 deadlocksCh07 deadlocks
Ch07 deadlocks
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Lecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptxLecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptx
 
Deadlock Slides
Deadlock SlidesDeadlock Slides
Deadlock Slides
 

More from Saba651353

scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .pptSaba651353
 
ARTIFICIAL INTELLIGENCE AI technology .pptx
ARTIFICIAL INTELLIGENCE AI technology .pptxARTIFICIAL INTELLIGENCE AI technology .pptx
ARTIFICIAL INTELLIGENCE AI technology .pptxSaba651353
 
Introduction_wsn.pptx
Introduction_wsn.pptxIntroduction_wsn.pptx
Introduction_wsn.pptxSaba651353
 
Microcontroller.pptx
Microcontroller.pptxMicrocontroller.pptx
Microcontroller.pptxSaba651353
 
LlosengCh10E2.ppt
LlosengCh10E2.pptLlosengCh10E2.ppt
LlosengCh10E2.pptSaba651353
 
Principles-of-SoftwareTesting.pptx
Principles-of-SoftwareTesting.pptxPrinciples-of-SoftwareTesting.pptx
Principles-of-SoftwareTesting.pptxSaba651353
 
Software_Verification_and_Validation.ppt
Software_Verification_and_Validation.pptSoftware_Verification_and_Validation.ppt
Software_Verification_and_Validation.pptSaba651353
 
security and usable.ppt
security and usable.pptsecurity and usable.ppt
security and usable.pptSaba651353
 
RFID_NFC_Tags.ppt
RFID_NFC_Tags.pptRFID_NFC_Tags.ppt
RFID_NFC_Tags.pptSaba651353
 
COMMUNICATING FINITE MACHINE.pptx
COMMUNICATING FINITE MACHINE.pptxCOMMUNICATING FINITE MACHINE.pptx
COMMUNICATING FINITE MACHINE.pptxSaba651353
 
730-214 - IEEE Standard for Software Quality Assurance.pptx
730-214 - IEEE Standard for Software Quality Assurance.pptx730-214 - IEEE Standard for Software Quality Assurance.pptx
730-214 - IEEE Standard for Software Quality Assurance.pptxSaba651353
 

More from Saba651353 (11)

scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .ppt
 
ARTIFICIAL INTELLIGENCE AI technology .pptx
ARTIFICIAL INTELLIGENCE AI technology .pptxARTIFICIAL INTELLIGENCE AI technology .pptx
ARTIFICIAL INTELLIGENCE AI technology .pptx
 
Introduction_wsn.pptx
Introduction_wsn.pptxIntroduction_wsn.pptx
Introduction_wsn.pptx
 
Microcontroller.pptx
Microcontroller.pptxMicrocontroller.pptx
Microcontroller.pptx
 
LlosengCh10E2.ppt
LlosengCh10E2.pptLlosengCh10E2.ppt
LlosengCh10E2.ppt
 
Principles-of-SoftwareTesting.pptx
Principles-of-SoftwareTesting.pptxPrinciples-of-SoftwareTesting.pptx
Principles-of-SoftwareTesting.pptx
 
Software_Verification_and_Validation.ppt
Software_Verification_and_Validation.pptSoftware_Verification_and_Validation.ppt
Software_Verification_and_Validation.ppt
 
security and usable.ppt
security and usable.pptsecurity and usable.ppt
security and usable.ppt
 
RFID_NFC_Tags.ppt
RFID_NFC_Tags.pptRFID_NFC_Tags.ppt
RFID_NFC_Tags.ppt
 
COMMUNICATING FINITE MACHINE.pptx
COMMUNICATING FINITE MACHINE.pptxCOMMUNICATING FINITE MACHINE.pptx
COMMUNICATING FINITE MACHINE.pptx
 
730-214 - IEEE Standard for Software Quality Assurance.pptx
730-214 - IEEE Standard for Software Quality Assurance.pptx730-214 - IEEE Standard for Software Quality Assurance.pptx
730-214 - IEEE Standard for Software Quality Assurance.pptx
 

Recently uploaded

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
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.
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
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.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 

Recently uploaded (20)

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
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...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
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 ...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 

deadlock and starvation resources allocation.pptx

  • 2. Deadlock • Permanent blocking of a set of processes that either compete for system resources or communicate with each other • No efficient solution • Involve conflicting needs for resources by two or more processes
  • 3. Reusable Resources • Used by only one process at a time and not depleted by that use • Processes obtain resources that they later release for reuse by other processes • Processors, I/O channels, main and secondary memory, devices, and data structures such as files, databases, and semaphores • Deadlock occurs if each process holds one resource and requests the other
  • 4. Reusable Resources • Space is available for allocation of 200Kbytes, and the following sequence of events occur • Deadlock occurs if both processes progress to their second request P1 . . . . . . Request 80 Kbytes; Request 60 Kbytes; P2 . . . . . . Request 70 Kbytes; Request 80 Kbytes;
  • 5. Consumable Resources • Created (produced) and destroyed (consumed) • Interrupts, signals, messages, and information in I/O buffers • Deadlock may occur if a Receive message is blocking • May take a rare combination of events to cause deadlock
  • 6. Example of Deadlock • Deadlock occurs if receives blocking P1 . . . . . . Receive(P2); Send(P2, M1); P2 . . . . . . Receive(P1); Send(P1, M2);
  • 7. Conditions for Deadlock • Mutual exclusion – Only one process may use a resource at a time • Hold-and-wait – A process may hold allocated resources while awaiting assignment of others
  • 8. Conditions for Deadlock • No preemption – No resource can be forcibly removed form a process holding it • Circular wait – A closed chain of processes exists, such that each process holds at least one resource needed by the next process in the chain
  • 9. Possibility of Deadlock • Mutual Exclusion • No preemption • Hold and wait
  • 10. Existence of Deadlock • Mutual Exclusion • No preemption • Hold and wait • Circular wait
  • 11. Deadlock Prevention • Mutual Exclusion – Must be supported by the OS • Hold and Wait – Require a process request all of its required resources at one time
  • 12. Deadlock Prevention • No Preemption – Process must release resource and request again – OS may preempt a process to require it releases its resources • Circular Wait – Define a linear ordering of resource types
  • 13. Deadlock Avoidance • A decision is made dynamically whether the current resource allocation request will, if granted, potentially lead to a deadlock • Requires knowledge of future process requests
  • 14. Two Approaches to Deadlock Avoidance • Do not start a process if its demands might lead to deadlock • Do not grant an incremental resource request to a process if this allocation might lead to deadlock
  • 15. Resource Allocation Denial • Referred to as the banker’s algorithm • State of the system is the current allocation of resources to process • Safe state is where there is at least one sequence that does not result in deadlock • Unsafe state is a state that is not safe
  • 16. • Assume we have 9 tape drives. Consider whether or not the above states are safe or unsafe. • Since only 7 (3+4) tape drives are currently on loan (allocated), two (2) tape drives are still available. • Process B can finish with only two additional tape drives. • Once Process B is done, it will release all 5 tape drives, making the number of available tape drives = 5.
  • 17. • With only three of these tape drives, either Process A or Process C may complete and release its tape drives. • This means that there are two possible safe sequences: <Process B, Process A, Process C> and <Process B, Process C, Process A>. • Thus, we say that this is a safe state.
  • 18. The Banker's Algorithm • Allows: – mutual exclusion – wait and hold – no preemption • Prevents: – circular wait • System grants request only if the request will result in a safe state.
  • 19. Strategies Once Deadlock Detected • Abort all deadlocked processes • Back up each deadlocked process to some previously defined checkpoint, and restart all process – Original deadlock may occur
  • 20. Strategies Once Deadlock Detected • Successively abort deadlocked processes until deadlock no longer exists • Successively preempt resources until deadlock no longer exists