Concurrency and Parallelism in Go (Short Post)
- Concurrency is not parallelism (VIDEO)
- Concurrency is not Parallelism (SLIDES)
- Go vs Erlang Concurrency
According to Rob Pike’s talk “Concurrency is not Parallelism”, Go is a primarily a concurrent language and the parallelism is a bi-product. He defines concurrency as the composition of independently executing processes and parallelism as the simultaneous execution of multiple “things” ( I presume he means processes in this case). Based on the CSP model defined in C.A.R. Houre’s 1978 paper ‘Communicating Sequential Processes (CACM)’, Go is a language focused around program structure and design. This essentially means that Go excels at solving certain types of parallel problems but is not be suitable for all such problems. This is a key thing to note as the usual hype surrounding the hottest new language leads to the said language (Go in this case) being misused and/or abused. I would say that Go is designed primarily to handle non-determinism and program complexity (That’s the main advantage of the CSP model employed). If every part of your program is simple and deterministic by nature then you should consider looking at using a different language to handle the task of pure parallelism.
This issue is discussed and debated in the yosefk blog and its comments (recommended read) where the author of the blog challenges some of the statements made by the concurrency fan boys.
Golang Concurrency Motto :Do not communicate by sharing memory; instead, share memory by communicating.