liveBook · Manning

Pipeline

As explained in C++ Concurrency in Action, Second Edition

A pipeline is a processing pattern in which work passes through a sequence of stages.

A pipeline processes many independent data items through the same sequence of operations. Each stage runs on its own thread; when a stage finishes an item, it places it in a queue for the next stage. This lets one stage begin the next item while later stages handle earlier ones. section 8.1.3

This approach can suit inputs that arrive over time, such as network data, or work where the first operation discovers items, such as scanning a filesystem. It is an alternative to dividing the data among threads and can change the performance profile when each operation takes substantial time. section 8.1.3

Comparing work division

Consider 20 items, four cores, and four operations per item, each taking three seconds. This setup illustrates how pipeline work division differs from assigning five items to each of four threads. section 8.1.3

How C++ Concurrency in Action, Second Edition covers it

How deep it goes
Explains stage threads and queue handoffs, then motivates the performance tradeoff without detailing synchronization implementation.
Examples
Uses network arrivals, filesystem scanning, and a 20-item workload to illustrate pipeline use and performance comparison.
What you can do after
Apply a pipeline by assigning operations to threads and passing completed items through queues.
How it connects
Connects pipelines to concurrency, threads, queues, and data-parallel work division.

Also explained in

Compare how 48 books explain pipeline →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of C++ Concurrency in Action, Second Edition. The section links point to the parts of the book it draws on.