deadlock - Computer Science 322 Operating Systems Mount...

Info icon This 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); ... ...
Image of page 1

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

View Full Document Right Arrow Icon
CS 322 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.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern