2 Serial and parallel execution

 

In this chapter:

  • You learn the terminology to talk about a running program
  • You learn different approaches at the lowest layer of concurrency: physical task execution
  • You draft your first parallel program
  • You learn the limitations of the parallel computing approach

For thousands of years (well, not quite, but for a long time), developers have been writing programs using the simplest model of computation: the sequential model. The serial execution approach is at the core of sequential programming, and this is our starting point in our introduction to concurrency. In this chapter, I introduce different execution approaches that lie at the low-level execution layer.

Review: What is a program?

The first problem with concurrency, and computer science in general, is that we’re extremely bad at naming things. We sometimes use the same word to describe several distinct concepts, different words to describe the same thing, or even different words to describe different things where the meaning depends on context. And sometimes, we just make up words.

NOTE

Did you know that CAPTCHA is a contrived acronym for “Completely Automated Public Turing test to tell Computers and Humans Apart”?

So, before we start looking at execution, it will be helpful to understand what is being executed and to establish the general terminology we use in this book. Generally speaking, a program is a sequence of instructions that a computer system performs or executes.

Serial execution

Sequential computations

Pros and cons of sequential computing

Parallel execution

How to speed up the process of doing the laundry

Parallel computing requirements

Task independence

Hardware support

Parallel computing

Amdahl’s law

Gustafson’s law

Recap