Chapter 2. Concurrent or Not Concurrent?
To get things started, I want to first talk about two design methods for concurrent algorithms, but I want to do it abstractly. Now, before you roll your eyes too far back and hurt yourself, let me say that there will be plenty of code examples in later chapters to give concreteness to the ideas that are presented here. This is a book on the design of concurrent algorithms, and in this chapter I’ve collected a lot of the wisdom on initial approaches that apply to a large percentage of code you’re likely to encounter (it can get pretty dry without code to look at, so be sure you’re well hydrated before you start).
In addition, I want to let you know that not every bit of computation can be made concurrent, no matter how hard you try. To save you the time of trying to take on too many impossible things in the course of your day, I have examples of the kinds of algorithms and computations that are not very amenable to concurrency in the section What’s Not Parallel. When any of those examples can be modified to allow for concurrent execution, I’ve included hints and tips about how to do that.
Design Models for Concurrent Algorithms
If you’ve got a sequential code that you want to transform into a concurrent version, you need to identify the independent computations that can be executed concurrently. The way you approach your serial code will influence ...
Get The Art of Concurrency now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.