Pipeline¶
Category: Communication · Status: stub · Lessons: chapter 05, Message passing (planned)
One line: A chain of stages, each a task that reads from the previous stage's channel and writes to the next one's.
Also called: pipes and filters.
How it connects¶
flowchart LR
n_channel["Channel"]
n_pipeline["Pipeline"]
n_pipeline -->|uses| n_channel
classDef center stroke-width:3px
class n_pipeline center
classDef outside stroke-dasharray: 4 3
class n_channel outside
- Is built on: Channel
- See also: Dataflow programming, Fan-out, fan-in
In each language¶
| Rust | threads joined by mpsc ↗ channels; a stage's receives fail once the stage before it has hung up by dropping its sender |
| Go | goroutines joined by channels, each stage receiving from upstream and sending downstream; the Go blog's pipelines post ↗ notes there is no formal definition of one in Go |
| C# | TPL Dataflow ↗, in-process message passing for dataflow and pipelining tasks |
| JavaScript | ReadableStream.pipeThrough ↗ chains transform streams |
| Kotlin | a pipeline ↗: one coroutine produces a stream of values and others consume, process and pass it on |
| The operating system | the shell pipeline: processes connected by pipes ↗ |
Where to read more¶
- In a sibling library: Go: A pipeline of stages ↗
- In a sibling library: Rust: Channels ↗
- In the books: Effective Concurrency in Go, Burak Serdar — ch. 5, 'Worker Pools and Pipelines'
- In the books: Programming with POSIX Threads, David R. Butenhof — ch. 4, 'A Few Ways to Use Threads' → 'Pipeline'
- In the books: Pro TBB, Michael Voss, Rafael Asenjo, James Reinders — ch. 2, 'Generic Parallel Algorithms' → 'Cook Until Done: parallel_do and parallel_pipeline'
- In the books: Parallel and Concurrent Programming in Haskell, Simon Marlow — ch. 4, 'Dataflow Parallelism: The Par Monad' → 'Pipeline Parallelism'
- In the books: Parallel Programming and Concurrency with C# 10 and .NET 6, Alvin Ashcraft — ch. 7, 'Task Parallel Library (TPL) and Dataflow' → 'Creating a data pipeline with multiple blocks'
- In the books: Parallel Programming with Python, Jan Palach — ch. 2, 'Designing Parallel Algorithms' → 'Decomposing tasks with pipeline'
- Reference: Wikipedia: Pipeline (software) ↗