Threads of execution working together to solve a common problem require some form of communication. This is what is known as inter-thread communication (ITC), or inter-process communication (IPC) when referring to processes. This type of communication falls under two main classes: memory sharing and message passing. In this chapter, we will focus on the former.
Memory sharing is similar to having all our executions share a large, empty canvas (the process’s memory) on which each execution gets to write the results of its own computation. We can coordinate the executions in such a way that they collaborate using this empty canvas. In contrast, message passing is exactly what it sounds like. Just like people, threads can communicate by sending messages to each other. In chapter 8, we’ll investigate message passing in Go using channels.