Book contents
- Frontmatter
- Contents
- Preface
- Legend
- 1 Introduction
- 2 Concepts in Concurrent Programming
- 3 An Introduction to Concurrent ML
- 4 CML Programming Techniques
- 5 Synchronization and Communication Mechanisms
- 6 The Rationale for CML
- 7 A Software Build System
- 8 A Concurrent Window System
- 9 A CML Implementation of Linda
- 10 Implementing Concurrency in SML/NJ
- Appendix A A CML Reference
- Appendix B The Semantics of CML
- Bibliography
- Index
2 - Concepts in Concurrent Programming
Published online by Cambridge University Press: 07 October 2009
- Frontmatter
- Contents
- Preface
- Legend
- 1 Introduction
- 2 Concepts in Concurrent Programming
- 3 An Introduction to Concurrent ML
- 4 CML Programming Techniques
- 5 Synchronization and Communication Mechanisms
- 6 The Rationale for CML
- 7 A Software Build System
- 8 A Concurrent Window System
- 9 A CML Implementation of Linda
- 10 Implementing Concurrency in SML/NJ
- Appendix A A CML Reference
- Appendix B The Semantics of CML
- Bibliography
- Index
Summary
Concurrent programming differs from sequential programming in several significant ways. Conceptually, we can view the execution of a concurrent program as an interleaving of the sequential execution of its constituent processes. Since there are many possible interleavings, the execution of a concurrent program is nondeterministic; i.e., different interleavings may produce different results. In effect, a concurrent program defines a partial order on its actions, whereas a sequential program defines a total order. This nondeterminism is both the bane and boon of concurrent programming: on the one hand, it creates additional correctness problems, while on the other hand, it provides flexibility and a more natural program structure. As argued in Chapter 1, the choice of programming notation can help the programmer control the complexity of concurrency, while reaping its benefits.
A concurrent language typically consists of a sequential core (or sub-language), extended with support for concurrency. The concurrency support can be divided into three different kinds of mechanism:
• A mechanism for introducing independent sequential threads of control, called processes. The process creation mechanism can be either static, restricting the program to a fixed number of processes, or dynamic, allowing new processes to be created “on-the-fly.”
• A mechanism for processes to communicate. Communication involves exchanging data, either through shared memory locations (e.g., variables) or by explicit message passing.
• And a mechanism for processes to synchronize. Synchronization restricts the ordering of execution in otherwise independent threads, and is used to limit the program's nondeterminism where necessary.
- Type
- Chapter
- Information
- Concurrent Programming in ML , pp. 11 - 38Publisher: Cambridge University PressPrint publication year: 1999