22 Deadlocks and Starvation

22 Deadlocks and Starvation - CS-350: Fundamentals of...

Info iconThis preview shows pages 1–2. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS-350: Fundamentals of Computing Systems Page 1 of 12Lecture Notes Azer Bestavros. All rights reserved. Reproduction or copying (electronic or otherwise) is expressly forbidden except for students enrolled in CS-350. Concurrency and Synchronization: Deadlocks and Starvation As we have observed when discussing the dining philosophers problem, deadlock and thus the possibility of starvation should be a matter of concern whenever entities (such as processes, threads, applications, etc.) compete for resources, and may block waiting for them to become available. For the dining philosopher problem, we saw how one may rely on knowledge of the specific problem at hand to find a clever way to ensure that deadlocks/starvation will not occur. Generally speaking, however, this is not a practical approach. In particular, it will be quite hard to generalize to larger problems or more complicated scenarios when multitudes of resources of different types and many competing processes are involved. What we need is a disciplined approach for how to manage synchronization in such a way that does not allow for deadlocks to occur. Deadlock: A Definition A deadlock involves conflicting needs for resources by two or more processes. It is defined as a permanent blocking of a set of processes that either compete for system resources or communicate with each other.Before we proceed in discussing what we can do about deadlocks, it is important to note that in general there is no silver bullet for dealing with deadlocks. Indeed, in many systems (e.g., operating systems such as Windows or Unix SVR4) deadlocks essentially ignoredthey are a necessary evil that we just deal with when they occur (perhaps by pushing the dreaded ctrl-alt-del combination of keys). Understanding how deadlocks occurs Deadlock occurs when processes have no way of making progress. To illustrate this point, we consider the simplest case of two processes P and Q and discuss how they could get stuck in a deadlock. Clearly, if P and Q do not have any common resources that they need in order to make progress, then there is absolutely no danger of them being deadlocked. In other words, in such a situation, P and Q can each make progress independent of the other; there is no way for one process to impede the progress of the other since they have nothing in common. In our illustrative Dining Philosophers problem, if the philosophers (processes) did not have to share the chopsticks, we would not have had to worry about deadlocks. Now, lets assume that P and Q do indeed share resources. Could that lead to a deadlock? The answer is that it depends on the type of resources they share. Specifically, two possibilities exist....
View Full Document

This document was uploaded on 04/14/2011.

Page1 / 12

22 Deadlocks and Starvation - CS-350: Fundamentals of...

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

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