In this chapter, the reader will learn how to program both POSIX and C++ threads. We will start by discussing how to program with POSIX threads, and then move on to C++ threads, providing a comparison of the APIs for each one.
Then we will present three examples. The first will demonstrate how to use threading to perform a parallel computation. The second will demonstrate how to create your own high-resolution timer using threading in order to perform benchmarking (albeit a timer that is likely not very accurate).
The third and final example will build upon our existing debugging example to provide support for multiple clients.
It should be noted that this chapter assumes the reader already has a basic understanding of threading, thread synchronization, and the challenges associated with race conditions and deadlock. Here, we will only...