CS345 06 - Concurrency

CS345 06 - Concurrency - BYU CS 345 Concurrency 1 Chapter 6...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: BYU CS 345 Concurrency 1 Chapter 6 Concurrency: Deadlock and Starvation BYU CS 345 Concurrency 2 Topics to Cover… Resources Deadlock Joint Process Diagrams Deadlock Conditions Circular Wait Resource Allocation Graph Handling Deadlock Avoidance Detection Recovery Objectives BYU CS 345 Concurrency 3 Reusable Resources Used by one process at a time and not depleted by that use Processes obtain resources that they later release for reuse by other processes Processor time, I/O channels, main and secondary memory, files, databases, and semaphores Deadlock occurs if each process holds one resource and requests the other Resources BYU CS 345 Concurrency 4 Consumable Resources Created (produced) and destroyed (consumed) by a process 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 Resources BYU CS 345 Concurrency 5 Deadlock System Model Process must request a resource before using Process must release the resource when done Deadlock A set of processes is in a deadlock state when every process in the set is waiting for an event that can only be caused by another process in the set. Deadlock BYU CS 345 Concurrency 6 Examples of Deadlock Deadlock occurs if receive blocks… Process 1 Process 2 Request 80K bytes … … Request 70K bytes Request 60K bytes … … Request 80K bytes Process 1 Process 2 Receive(P2) … … Receive(P1) Send(P2) … … Send(P1) 200K bytes is available for allocation… Deadlock BYU CS 345 Concurrency 7 Deadlock BYU CS 345 Concurrency 8 Joint Process Diagram Progress of Q Release A Release B Get A Get B Get A Get B Release A Release B Progress of P deadlock inevitable A Required B Required B Required P and Q want B P and Q want A 3 5 6 2 4 1 Fatal Region Deadlock Possible! A Required Diagrams BYU CS 345 Concurrency 9 Example of No Deadlock Progress of Q Release A Release B Get A Get B Get A Get B Release A Release B Progress of P A Required B Required A Required B Required 1 2 3 4 5 6 P and Q want A P and Q want B Diagrams BYU CS 345 Concurrency 10 Necessary Conditions Mutual exclusion only one process may use a resource at a time. no process may access resource allocated to another. Hold-and-wait a process may hold allocated resources while awaiting assignment of other resources. No preemption no resource can be forcibly removed from a process holding it. Necessary Conditions BYU CS 345 Concurrency 11 Conditions for Deadlock 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 consequence of the first three conditions Other conditions are necessary but not sufficient for deadlock - all four conditions must hold for deadlock Unresolvable circular wait is the definition of deadlock!...
View Full Document

This note was uploaded on 03/02/2012 for the course C S 345 taught by Professor Ericmercer during the Winter '12 term at BYU.

Page1 / 39

CS345 06 - Concurrency - BYU CS 345 Concurrency 1 Chapter 6...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online