Book contents
- Frontmatter
- Contents
- Preface
- 1 Predicate Logic
- 2 The Simple Imperative Language
- 3 Program Specifications and Their Proofs
- 4 Arrays
- 5 Failure, Input-Output, and Continuations
- 6 Transition Semantics
- 7 Nondeterminism and Guarded Commands
- 8 Shared-Variable Concurrency
- 9 Communicating Sequential Processes
- 10 The Lambda Calculus
- 11 An Eager Functional Language
- 12 Continuations in a Functional Language
- 13 Iswim-like Languages
- 14 A Normal-Order Language
- 15 The Simple Type System
- 16 Subtypes and Intersection Types
- 17 Polymorphism
- 18 Module Specification
- 19 Algol-like Languages
- Appendix: Mathematical Background
- Bibliography
- Index
8 - Shared-Variable Concurrency
Published online by Cambridge University Press: 28 January 2010
- Frontmatter
- Contents
- Preface
- 1 Predicate Logic
- 2 The Simple Imperative Language
- 3 Program Specifications and Their Proofs
- 4 Arrays
- 5 Failure, Input-Output, and Continuations
- 6 Transition Semantics
- 7 Nondeterminism and Guarded Commands
- 8 Shared-Variable Concurrency
- 9 Communicating Sequential Processes
- 10 The Lambda Calculus
- 11 An Eager Functional Language
- 12 Continuations in a Functional Language
- 13 Iswim-like Languages
- 14 A Normal-Order Language
- 15 The Simple Type System
- 16 Subtypes and Intersection Types
- 17 Polymorphism
- 18 Module Specification
- 19 Algol-like Languages
- Appendix: Mathematical Background
- Bibliography
- Index
Summary
In recent years, the dramatic drop in the cost of computing hardware has made it practical, in an ever-increasing variety of contexts, to execute different parts of a program simultaneously. Many authors use the terms “concurrent” or “parallel” indifferently to describe such computations. Following increasingly common usage, however, we will use concurrent to describe computations where the simultaneously executing processes can interact with one another, and we will reserve parallel to describe computations where the behavior of each process is unaffected by the behavior of the others.
Our present concern is concurrency. In this chapter, we consider an approach where processes communicate through shared variables. This approach mirrors the situation where a common memory, typically containing a shared database, is accessed by several physical processors – or perhaps by a single processor that is time-shared among several logical processes. (An alternative approach to concurrency, where processes communicate by passing messages, will be described in Chapter 9.)
Except in trivial cases, the interaction between concurrent processes will depend on the relative speed of the physical processors or on the decisions by a scheduler of when to switch a physical processor from one logical process to another. Thus concurrent programs are usually nondeterminate. This nondeterminacy makes concurrent programs especially difficult to reason about, since one must consider all possible orders of execution. Moreover, the efficacy of debugging is undermined by the irreproducibility of executions and by the fact that the actual occurrences of obscure and possibly erroneous orders of execution may be very infrequent.
- Type
- Chapter
- Information
- Theories of Programming Languages , pp. 155 - 180Publisher: Cambridge University PressPrint publication year: 1998