O'Reilly logo

Go: Design Patterns for Real-World Projects by Mat Ryer, Mario Castro Contreras, Vladimir Vivien

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Concurrency Patterns - Barrier, Future, and Pipeline Design Patterns

Now that we are familiar with the concepts of concurrency and parallelism, and we have understood how to achieve them by using Go's concurrency primitives, we can see some patterns regarding concurrent work and parallel execution. In this chapter we'll see the following patterns:

  • Barrier is a very common pattern, especially when we have to wait for more than one response from different Goroutines before letting the program continue
  • Future pattern allows us to write an algorithm that will be executed eventually in time (or not) by the same Goroutine or a different one
  • Pipeline is a powerful pattern to build complex synchronous flows of Goroutines that are connected with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required