Chapter 10. Concurrency with Boost
Threads represent concurrent streams of execution within a process. They are a low-level abstraction for concurrency and are exposed by the system programming libraries or system call interfaces of operating systems, for example, POSIX threads, Win32 Threads. On multiprocessor or multicore systems, operating systems can schedule two threads from the same process to run in parallel on two different cores, thus achieving true parallelism.
Threads are a popular mechanism to abstract concurrent tasks that can potentially run in parallel with other such tasks. Done right, threads can simplify program structure and improve performance. However, concurrency and parallelism introduce complexities and nondeterministic behavior unseen in single-threaded programs, and doing it right can often be the biggest challenge when it comes to threads. A wide variance in the native multithreading libraries or interfaces across operating systems makes the tasks of writing portable...