Channel
A channel is a type-safe message queue for communication and synchronization between coroutines/threads, implementing the CSP concurrency model.
Purpose
Achieve concurrent communication through message passing instead of shared memory, avoiding races.
Mechanism
A sender puts messages into a channel and a receiver takes them out. Channels come in buffered (asynchronous) and unbuffered (synchronous) forms. Go channels are first-class citizens. select multiplexes channels. Closing a channel broadcasts completion.
Use cases
- Concurrent communication
- Go programming
- CSP model