Debugging, Testing, and Performance
Writing concurrent code does not mean the job is done—we have to verify that it is both correct and efficient. Concurrent bugs have a particularly insidious nature: they might run ten thousand times without issue on your development machine, only to blow up intermittently in production. Furthermore, "good performance" in a concurrent context is an engineering problem that demands scientific measurement, not gut feeling.
In this chapter, we tackle two ultimate questions: first, how to systematically discover and diagnose concurrent bugs (data races, dead locks, livelocks, and dangling references) using tools; second, how to scientifically measure the performance of concurrent programs while avoiding the various pitfalls of benchmarking.