Chapter 3

Shared-memory programming

threads

Abstract

Threads are the basic vehicle for utilizing multicore platforms. In this chapter we explore in detail all the aspects of a thread’s lifetime, including creation, control, coordination and termination.

Thread-based development requires significant effort when compared to automated systems like OpenMP, but threads can make-up for this by affording a greater degree of control and potentially delivering more performance.

In this chapter we start from a brief, gentle introduction to concurrency using processes, before moving to threads. Modern threading libraries like Qt, provide advanced thread management facilities, that allow a programmer to utilize threads without the hassle of explicitly ...

Get Multicore and GPU Programming 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.