chapter06 - Deadlock Permanent blocking of a set of...

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

View Full Document Right Arrow Icon
1 Concurrency: Deadlock and Starvation Chapter 6 Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other A set of processes is deadlocked when each process in the set is blocked awaiting an event that can only be triggered by another blocked process in the set. No efficient solution in the general case Involve conflicting needs for resources by two or more processes. Process Q Get B Get A Release B Release A Process P Get A Get B Release A Release B Process Q Get B Get A Release B Release A Process P Get A Release A Get B Release B Resource Types Reusable resource Consumable resource
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 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 Processors, I/O channels, main and secondary memory, files, databases, and semaphores Deadlock occurs if each process holds one resource and requests the other Example of Deadlock Deadlock: p0p1q0q1p2q2 Another Example of Deadlock Space is available for allocation of 200K bytes, and the following sequence of events occur Deadlock occurs if both processes progress to their second request P1 . . . . . . Request 80K bytes; Request 60K bytes; P2 . . . . . . Request 70K bytes; Request 80K bytes; Consumable Resources Can be 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 Example of Deadlock Consider a pair of processes, in which each process attempts to receive a message from the other process and then send a message to the other process: P1 . . . . . . Receive (P2); Send (P2, M1); P2 . . . . . . Receive (P1); Send (P1, M2); Deadlock occurs if receive is blocking Four 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 other resources No preemption No resource can be forcibly removed from a process holding it
Background image of page 2
3 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 Three Approaches to Deal With Deadlock Deadlock Prevention Adopting a policy that eliminates one of the conditions Deadlock Avoidance Making appropriate dynamic choices based on the current state of resource allocation Deadlock Detection Detect deadlock and take action to recover Deadlock Prevention No Mutual Exclusion Cannot be disallowed Hold and Wait Can be prevented by A process requests all the required resources at one time Blocking the process until all requests can be granted
Background image of page 3

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

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

This note was uploaded on 11/26/2011 for the course CSE 410 taught by Professor Bonakdarpour during the Spring '08 term at Michigan State University.

Page1 / 9

chapter06 - Deadlock Permanent blocking of a set of...

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

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