Return to the Lecture Notes Index

Lecture 11 (Wednesday, February 9, 2000)

Many thanks to Filipe Fortes and Adam Ruprecht for their contributions to today's notes. -GMK

Reading:

Chapter 8

A Quick Review

A resource is an abstraction for any reason to wait. For our purposes, resoures are non-sharable and serially reusable. That means that only one process (or thread) can use a resource at the same time. The resource becomes available for use only after the first user has released it.

  1. Request resource - if available then request is granted; otherwise, it is delayed until the resource is available
  2. use resource
  3. release resource

Def'n: Deadlock - The condition that arises when there is a set of processes (or threads) such that each process (or thread) holds a resource that another process in the set is waiting to acquire. This situation forces all processes (or threads) in the set to wait forever.

Conditions Necessary For Deadlock:

All of these conditions are necessary for deadlock to occur. If any condition is not satisified, the system is not in a deadlocked state. If it is impossible to satisfy all four conditions concurrently, deadlock is impossible.

  1. Mutual exclusion - at least one resource must be held in a non-sharable way
  2. Hold and wait - at least one process is holding a resource and waiting for another resource that is currently in use
  3. No preemption (of holder) - while holding, no process can take the resource away from you
  4. Circular wait - there must exist a circular chain of processes, each waiting for a resource held by next process in the chain

Resource Allocation Graphs

Resource allocation graphs can be used describe a system's use of resources and demonstrate the existance of deadlocks.

Consider a resource allocation graph, G, a set of tuples, {V, E}, where V is a vertex and E is an edge.

There are two types of verticies: