Chapter 20. Threads

The typical C program is a sequential, or single-threaded, program. That is, there is one locus of control in the program. A program’s location counter gives the address of each instruction as it is executed. Most of the time, the location is advanced sequentially, one instruction at a time. Occasionally, a jump or call instruction causes the location counter to change to the jump destination or to the address of the function called. The values of the location counter trace out a path through the program that describes its execution, and this path looks like a thread through the program.

A concurrent or multithreaded program has more than one thread, and, in the most general case, these threads are all executing at the same ...

Get C Interfaces and Implementations: Techniques for Creating Reusable Software now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.