Chapter 2.5

CP.3: Minimize explicit sharing of writable data

Traditional execution model

The concurrency and parallelism section of the Core Guidelines addresses a well-known fact of programming life for C++ developers: multithreaded programming is harder than single-threaded programming. It introduces a unique class of errors to bemuse the unwary. It is ferociously hard to debug multiple threads of execution since the primary tool of debugging, stepping through code line by line, is a strictly serial process.

Let us consider how we got here. You will almost certainly have encountered a diagram like that shown in Figure 2.5.1.

Images

Figure 2.5.1. ...

Get Beautiful C++: 30 Core Guidelines for Writing Clean, Safe, and Fast Code 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.