deadlock - Computer Science 322 Operating Systems Mount...

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

View Full Document Right Arrow Icon
Computer Science 322 Operating Systems Mount Holyoke College Spring 2008 Topic Notes: Deadlock The idea of deadlock has come up a few times so far: A group of processes is deadlocked if each process is waiting for an event that can be caused only by one of the other waiting processes. Consider a one-lane tunnel (see http://www.teresco.org/pics/xc-19990722-0810/ disk09/mvc-018f.jpg ) or underpass: One-lane traffic inside the tunnel The lane in the tunnel is a shared resource If a deadlock like this one occurs, we must tell one of the cars it has to give up its right to the resource and rollback This may mean more than one car has to back up Starvation is possible if we keep allowing cars from one direction to enter The traffic analogy can become more complex with two-way intersections – gridlock! We have seen the potential for deadlock when using semaphores: P 0 P 1 wait(Q); wait(R); wait(R); wait(Q); ... ... signal(R); signal(Q); signal(Q); signal(R); ... ...
Background image of page 1

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

View Full DocumentRight Arrow Icon
Operating Systems Spring 2008 This is a situation that came up with the original “solution” to the dining philosophers. We will consider processes that need access to more general resources . These could be any non- preemptable resources, such as tape drives or CD burners, in addition to things like the semaphores. Requirements for Deadlock Four conditions must hold simultaneously for deadlock to arise: 1. Mutual exclusion : only one process at a time can use a resource 2. Hold and wait : a process is holding, but not necessarily using, at least one resource and is waiting to acquire additional resources held by other processes 3. No preemption : 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 circular chain of waiting processes, each of which it waiting for a resource held by the next process in the chain P1 Pn P2 P0 If any one of these conditions does not hold, deadlock cannot occur. Resource Allocation Graphs We model systems for our study of deadlock using directed graphs. The vertices of our graph are processes , represented by circles, P0 and resources , represented by squares, which may have a number of “dots” inside to indicate multiple equivalent instances of a resource. 2
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/15/2010 for the course CS 322 taught by Professor Teresco during the Spring '08 term at Mt. Holyoke.

Page1 / 7

deadlock - Computer Science 322 Operating Systems Mount...

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

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