Google I/O 2012 - Go Concurrency Patterns
Google for Developers
51 min, 27 sec
Rob Pike's presentation on Go concurrency patterns covers the background of concurrency in Go, its distinction from parallelism, and practical patterns for writing concurrent software.
Summary
- Rob Pike introduces concurrency in Go and differentiates it from parallelism.
- Concurrency in Go is achieved using goroutines and channels, allowing for independent and synchronous execution of functions.
- Detailed examples demonstrate patterns such as generator, fan-in, timeout, and quitting goroutines, simulating a Google search.
- Rob Pike emphasizes using the right concurrency tools for the right job and suggests that tools like thread sanitizer and SPIN can be used for static verification.
Chapter 1
Chapter 2
Chapter 3
The distinction between concurrency and parallelism is clarified.
- Concurrency is not parallelism; it's more about the composition and structure of programs.
- Concurrency is used for structuring software to interact with the real world, and it can be executed even on a single processor.
Chapter 4
Rob Pike provides a brief history of concurrency in programming languages.
- Concurrency has a long history in programming languages, with seminal papers and languages contributing to its development.
- Tony Hoare's paper 'Communicating Sequential Processes' is foundational for understanding concurrency.
Chapter 5
Chapter 6
Channels are introduced as a way for goroutines to communicate and synchronize.
- Channels in Go allow goroutines to communicate and synchronize by sending and receiving messages.
- Channels block on send and receive operations until the other side is ready, ensuring synchronization.
Chapter 7
Chapter 8
Chapter 9
Timeout and quitting patterns in concurrency are explored.
- Timeout patterns allow goroutines to proceed only if an operation can complete within a certain timeframe.
- Quitting patterns provide a way for goroutines to signal completion and perform cleanup.
Chapter 10
Rob Pike explains the select statement for controlling concurrent operations.
- The select statement in Go is used to control which concurrent operation should proceed when multiple are possible.
- Cases in a select statement are chosen pseudo-randomly if multiple are ready.
Chapter 11
Chapter 12
Chapter 13
Rob Pike provides best practices and cautions for using concurrency in Go.
- Concurrency should be used for the right job, and not all problems require concurrency features.
- Simpler synchronization mechanisms like reference counters can be more appropriate for certain tasks.
More Google for Developers summaries
The Go Programming Language Promo
Google for Developers
Russ Cox from the Go team at Google showcases the speed and efficiency of building and testing in the Go programming language.
Google I/O 2009 - The Myth of the Genius Programmer
Google for Developers
A detailed exploration of common myths about programming genius and the importance of collaboration.
Google I/O 2012 - The Art of Organizational Manipulation
Google for Developers
A detailed guide on navigating and influencing the internal dynamics of an organization.
Google I/O 2014 - The ART runtime
Google for Developers
An in-depth look at ART, the Android runtime that replaces Dalvik, including its performance improvements and 64-bit support.
Reimagine the Future of Gaming with Google AI
Google for Developers
A detailed exploration of Google's partnerships in gaming, AI's transformative role in game development and publishing, and a demonstration of smart NPCs in a live game environment.