A Simple Process

Learn about working processes in Elixir.

One of Elixir’s key features is the idea of packaging code into small chunks that can be run independently and concurrently.

Concurrent programming is known to be difficult, and there’s a performance penalty to pay when we create lots of processes.

Elixir doesn’t have these issues, thanks to the architecture of the Erlang VM on which it runs. Elixir uses the actor model of concurrency. An actor is an independent process that shares nothing with any other process. We can spawn new processes, send them messages, and receive messages back. And that’s it.

In the past, we may have had to use threads or operating system processes to achieve concurrency. Each time, it might’ve felt very risky. There was so much that could go wrong. But that worry just evaporates in Elixir. In fact, Elixir developers are so comfortable creating new processes that they’ll often do it at times when we would’ve created ...