Channels

Channels

Go’s concurrency model is based on “Do not communicate by sharing memory; instead, share memory by communicating”, and channels is the way of achieving this. Channels are used for inter Go Routine communication. Unlike other programming language where objects/memory is shared between two or more thread by acquiring lock, in Go channels are used to pass the objects to Go Routine thereby ensuring only one Go Routine have access to it.