GENERAL NOTES ON CONCURRENCY

 

1. OVERVIEW

We are studying the interaction of concurrent sequential processes.

Each process is a sequence of process steps. We may define process steps to be any unit approporiate to the discussion. We consider them atomic -- we don't care what takes place within them.

Processes perform operations on resources.

Most of the resources we are concerned with are serially reusable. They may be reused, but only by one process at a time. Some resources, such as messages, are consumable; they are used once and disappear.

2. PRINCIPAL PROBLEMS

Processes that do not intentionally communicate interact due to competition for finite resources. In this case we address two main problems: determinism and scheduling.

The problem of preserving determinisim, discussed below, is addressed by study of mutual exclusion, synchronization, and deadlock.

The scheduling problem is to ensure that criteria based on peformance and fairness can be met in the presence of continual competition for resources.

The scheduling problem arises primarily for processors and memory. These resources are continuously needed by all processes, so there is almost always competition and waiting.

Other resources are needed only occasionally. For these, the primary issues are mutual exclusion and deadlock.

3. DETERMINISM

A process has the property of determinism if its outputs are determined only by its inputs, that is, not by the actions of other processes or the operating system. This does not include a timing guarantee, except that the process must complete eventually.

Our goal is to preserve this property while allowing resources to be shared. This should be possible, provided that

  1. There is no intended interaction between processes
  2. Correct behavior is not time-dependent

We may model the actions of a process in terms of its effect on the state of a system, consisting of all storage and I/O. The set of all state elements read by a process is called its read set. The set of all state elements written by a process is called its write set.

There is a potential conflict between processes only if the write set of one overlaps the read set of another. In this case we have a risk of violating determinism, unless we can maintain mutual exclusion and avoid deadlock.

4. MUTUAL EXCLUSION

We identify four conditions required for a satisfactory solution to mutual exclusion. These were first stated by Dijkstra:

  1. Mutual exclusion must be assured
  2. Progress: no process should be blocked except by another that is using or waiting to use the resource
  3. Deadlock must be prevented
  4. Bounded waiting (weak fairness) must be assured: ther must be a bound on how many times one process may use a resource while another process waits

5. DEADLOCK

There are three main strategies to overcome deadlock:

  1. Deadlock prevention: rule out one of the four required conditions by design.
  2. Deadlock avoidance: dynamically avoid allocations that would put the system in an unsafe state.
  3. Deadlock detection and recovery: determine if deadlock exists, and do something about it.

Two limitations on the use of the deadlock avoidance algorithm are:

  1. Full information is needed about the maximum resource use of each process
  2. The algorithm must be run very frequently: before every allocation decision.

6. IMPORTANT CONTRIBUTORS

Some important contributors to the study of concurrency are:

  1. Edsgar Dijkstra -- identified problems and algorithms and introduced semaphores
  2. Anthony Hoare -- Developed formal models and created the concept of monitors
  3. Per Brinch Hansen -- Further developed monitors and designed Concurrent Pascal
  4. Nico Habermann -- identified deadlock problems and the four necessary conditions