Parallelism executes multiple computations at the same time. In Go, goroutines launch independent pieces of code, while the runtime and operating system schedule work across available execution resources. section 7.2.1 section 7.2
Cooking two pots
Cooking curry sauce and rice sequentially takes about 20 minutes. Cooking both for 10 minutes at once can reduce the total time to about 10 minutes, provided enough burners are available. Independent program tasks can benefit similarly. section 7.2.1
Use parallelism with these practical boundaries:
- Launch goroutines when tasks can proceed independently without waiting for one another. section 7.2.1
- Distinguish concurrency from parallelism: multiple goroutines may run independently without executing simultaneously on parallel cores. section 7.2.1
- Expect overhead: creating goroutines and communicating with them can outweigh gains for very quick tasks, while CPU usage increases. section 9.3.2
- Coordinate communicating goroutines with channels, which carry notifications such as newly available work. section 9.3.2
Parallel maze exploration
At a maze intersection, continue along one direction and start goroutines for the alternatives. Each explorer can continue until it finds the treasure or reaches a dead end; channels communicate new paths. section 9.3.2
Figure 9.4 exploration by different goroutines
Compare how different goroutines explore separate maze paths from a branching point. section 9.3.2




































