What exactly is a thread?

In the good (or bad?) old days, Unix programmers had a straightforward software model (which got inherited pretty much exactly by other OSes and vendors): there is a process that lives in a virtual address space (VAS); the VAS essentially consists of homogeneous regions (essentially collections of virtual pages) called segments: text, data, other mappings (libraries), and stack. The text is really the executable—in fact, the machinecode that is fed to the processor. We have certainly covered all of this earlier in this book (you can brush up on these basics in Chapter 2, Virtual Memory).

A thread is an independent execution (or flow) path within a process. The life and scope of a thread, in the familiar procedural ...

Get Hands-On System Programming with Linux 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.