Concurrency in Go and Elixir: A Comparative Study

113
clicks
Concurrency in Go and Elixir: A Comparative Study
During the EMPLEX LA 2019 event, Anna Neyzberg and Hannah Howard delivered an in-depth discussion on the concurrency models of Go and Elixir, illustrating the differences and similarities between the two. Beginning with a historical perspective on concurrency, they touched upon the evolution from single-process execution to the modern capability of handling multiple activities simultaneously, yet virtually, on multiprocessor systems. They explained how Elixir leverages the Actor Model—a concept of independent, isolated processes communicating via messages—whereas Go is based on Communicating Sequential Processes (CSP), where processes coordinate through channel-based message passing. The talk underscored that although both languages manage their own concurrent code and prioritize message passing as a synchronization tool, there are notable differences in their approach. Elixir processes are identified by unique addresses and can communicate both locally and in a distributed manner. Processes operate asynchronously and follow the 'let it crash' philosophy with a supervision process for system reliability. On the other hand, Go routines—similar to lightweight threads—do share memory and may use traditional locking mechanisms for coordination. CSP messages in Go are synchronous, necessitating processes or threads to be active receivers for communication, potentially causing blocking issues. Despite the disparities, both Anna and Hannah demonstrated how concepts from one model could, to some extent, be emulated in the other environment, albeit with some loss of natural language fluency. They concluded by emphasizing that the choice of programming language should be a thoughtful decision based on the specific needs of the system being developed, rather than a strict adherence to one particular concurrency model over another.

© HashMerge 2024