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 ...

Get Go: Design Patterns for Real-World Projects 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.