Skip to content
  • Sign In
  • Try Now
View all events
Go

Concurrent Programming in Go - with Interactivity

Published by O'Reilly Media, Inc.

Intermediate content levelIntermediate

Make your Go programs more efficient, responsive, and scalable

Course outcomes

  • Understand the behavior of channels and goroutines in Go
  • Make use of select statements and contexts to cancel running goroutines
  • Analyze and avoid resource leaks and deadlocks in concurrent code
  • Understand the use of wait groups, mutexes, and conditions
  • Understand the in-memory behavior of buffered channels
  • Apply common concurrency patterns such as fan-in, fan-out, and map-reduce

Course description

Go provides well-behaved, scalable, cross-platform concurrency primitives that are simple to reason about, but writing correct concurrent code in Go can be challenging, because reasoning about concurrency and parallelism is difficult for the human mind.

Join expert Alex Mills to understand the fundamentals of Go's concurrency primitives—with a focus on building the intuition you need to write correct concurrent code. Topics covered will include concurrency versus parallelism, green threading, the happens-before relationship, channels, goroutines, select statements, defer statements, wait groups, fan-in/fan-out, contexts, mutexes and conditions, the in-memory behavior of buffered channels, timeouts, the map-reduce algorithm, channel closure, and avoiding resource leaks in concurrent code.

What you’ll learn and how you can apply it

  • Correctly reason about concurrent code in Go
  • Gain familiarity with Go's concurrency primitives, along with multiple examples
  • Be aware of common pitfalls and mistakes that can happen in Go and understand the dangers involved
  • Apply best practices for concurrent programming in Go
  • Learn common concurrent programming patterns such as fan-out, fan-in, and map-reduce

This live event is for you because...

  • You’re a software engineer.
  • You’re very familiar with one or more procedural programming languages, such as Java, JavaScript/TypeScript, C/C++, or Python.
  • You want to become familiar with concurrent programming in Go.

Prerequisites

Prerequisites:

  • Intermediate familiarity with one or more procedural programming languages
  • Exposure to function closures in one or more languages
  • A level of comfort using the Go Playground to edit and run code

Recommended preparation:

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Goroutines, channels, context and fan-out (60 minutes)

  • Demonstration: The fan-out pattern; context.Context
  • Hands-on exercise: WaitGroup
  • Q&A
  • Break

Fan-in challenge (60 minutes)

  • Presentation: The fan-in pattern and goal
  • Hands-on exercise: Apply the fan-in pattern
  • Demonstration: The correct fan-in pattern solution
  • Break

Buffered channels, conditions, mutexes (60 minutes)

  • Demonstration: Implementing buffered channels in Go from scratch; sync.Cond and blocking and waiting
  • Hands-on exercise: Receive
  • Q&A
  • Break

Map-reduce: Combining fan-out and fan-in (60 minutes)

  • Demonstration: Implementing map-reduce in Go from scratch
  • Challenge: Channel closure and graceful shutdown
  • Q&A

Your Instructor

  • Alex Mills

    Alex Mills received his Ph.D in Computer Science from the University of Texas at Dallas in 2017. His research involved work with concurrent systems and optimization algorithms. Since graduating, he has had the opportunity to serve as a technical mentor at several startups and large companies. His preferred method of instruction eschews slide decks in favor of live coding exercises.