Resource resource graphs given the four preconditions

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: ire a resource that is held by another thread. 3. Hold-and-wait. Holder blocks awaiting another resource. 4. Circular waiting. Threads acquire resources out of order. Resource Resource Graphs Given the four preconditions, some schedules may lead to circular waits. • Deadlock is easily seen with a resource graph or wait-for graph. The graph has a vertex for each process and each resource. If process A holds resource R, add an arc from R to A. If process A is waiting for resource R, add an arc from A to R. The system is deadlocked iff the wait-for graph has at least one cycle. S A n A grabs fork 1 and waits for fork 2. 1 2 B B grabs fork 2 and waits for fork 1. Dealing Dealing with Deadlock Deadlock 1. Ignore it. 2. Detect it and recover. Traverse the resource graph looking for cycles. • If a cycle is found, preempt: force one party to release and restart. 3. Prevent it statically by breaking one of the preconditions. • Assign a fixed partial ordering to resources; acquire in order. Number forks 1, 2, 3, … must acquire forks in increasing numeric order • Reduce multiple resources to a single resource. 4. Avoid it dynamically by denying some resource requests. Banker’s algorithm Next Next Lecture Synchronization: 6/28 Read Chap. 2 MOS HW #1 due 6/23 HW #2 out 6/28 Project #1 due 6/30...
View Full Document

This document was uploaded on 04/02/2014.

Ask a homework question - tutors are online