Chapter 3. Concurrency in Go
This chapter covers
- Understanding Go’s concurrency model
- Using goroutines for concurrent processing
- Locking and waiting
- Using channels for communication between goroutines
- Strategically closing channels
This chapter presents Go’s concurrency model. Unlike many recent procedural and object-oriented languages, Go doesn’t provide a threading model for concurrency. Instead, it uses goroutines and channels. Concurrency is cheap (resource-wise) and much easier to manage than traditional thread pools. This chapter first focuses on goroutines, functions capable of running concurrently. Then it dives into channels, Go’s mechanism for communicating between goroutines.
3.1. Understanding Go’s concurrency model
Roughly ...
Get Go in Practice now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.