Concurrency Patterns
Part of the Go course
Goroutines and channels are raw materials, like wood and screws. Knowing what they are does not tell you how to build a chair. In practice, almost all concurrent Go code is assembled from a handful of recognisable shapes, and once you can name them you will see them in every real codebase you open, doing the same job each time.
This lesson covers five of those shapes. Waiting on whichever of several things happens first. Telling work to stop before it finishes. Waiting for a group of goroutines to be done. Protecting a value that two goroutines both write to. And handing a big pile of jobs to a fixed team of workers instead of hiring one worker per job. ...
Want to learn Go Concurrency Patterns in a real environment?
Click below, get a fresh Linux box with Go ready to go, and work through Concurrency Patterns hands-on with an AI tutor that knows your code.
Start this lessonConcurrency PatternsWhat you'll learn
- Select statement
- Context.Context for cancellation
- Sync.WaitGroup
- Sync.Mutex
- Worker pool pattern
- Fan-out fan-in idea
Read this lesson in your language
All lessons in this course
20 lessons- 1Hello, Go25 min
- 2Variables and Types25 min
- 3Control Flow: if and for30 min
- 4Functions30 min
- 5Slices and Maps35 min
- 6Structs and Pointers35 min
- 7Methods and Interfaces35 min
- 8Error Handling35 min
- 9Modules and Project Structure35 min
- 10Tiny CLI Capstone40 min
- 11A Tour of the Standard Library40 min
- 12Testing and Benchmarks40 min
- 13Goroutines and Channels40 min
- 14Concurrency Patterns45 min
- 15Generics35 min
- 16HTTP Servers45 min
- 17Databases with database/sql45 min
- 18Performance and Profiling40 min
- 19Design Patterns in Go40 min
- 20Deployment and Production45 min
