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 each other according to some logic
Take a quick look at the description of the three patterns. They all describe some sort of logic to synchronize execution in time. It's very important to keep in mind that we are now developing concurrent structures...