https://github.com/andygeiss/channels
Parallel Computing in Go - Build effective pipelines by using channels
https://github.com/andygeiss/channels
channels concurrency concurrency-patterns go golang parallel-computing parallelism patterns
Last synced: 12 months ago
JSON representation
Parallel Computing in Go - Build effective pipelines by using channels
- Host: GitHub
- URL: https://github.com/andygeiss/channels
- Owner: andygeiss
- License: mit
- Created: 2023-05-28T18:46:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-28T18:54:36.000Z (almost 3 years ago)
- Last Synced: 2024-12-12T22:08:46.133Z (over 1 year ago)
- Topics: channels, concurrency, concurrency-patterns, go, golang, parallel-computing, parallelism, patterns
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# channels
This package provides reusable functions for creating, splitting, merging and multiplexing channels of any type to build effective pipelines.
The functions automatically use the available CPU cores and create and close the channels.
3) 6)
┌───────┐ ┌───────┐
┌─────►Process├─────┐ ┌───────►Process├─────┐
│ └───────┘ │ │ └───────┘ │
1) 2)│ 4)│ 5) │ 7)│ 8)
┌────────┐ ┌──┴──┐ ┌───────┐ ┌──▼──┐ ┌────┴────┐ ┌───────┐ ┌──▼──┐ ┌─────┐
│Generate├──►Split├──►Process├──►Merge├──►Multiplex├──►Process├──►Merge├──►Drain│
└────────┘ └──┬──┘ └───────┘ └──▲──┘ └────┬────┘ └───────┘ └──▲──┘ └─────┘
│ │ │ │
│ ┌───────┐ │ │ ┌───────┐ │
└─────►Process├─────┘ └───────►Process├─────┘
└───────┘ └───────┘
- [x] Drain receives each value from an input channel and does something with it.
- [x] Generate sends each value to the out channel.
- [x] Merge sends each value from a list of input channels to the out channel.
- [x] Multiplex sends each value from an input channel to every output channel.
- [x] Process works on each value from an input channel and sends the result to an output channel.
- [x] Split sends each value from an input channel to one of the output channels.