Anatomy of an Elixir Process
Published in
2 min readOct 23, 2016
Elixir/Erlang concurrency model is based on the actor pattern which runs on top of BEAM(Erlang Virtual Machine) instead of running directly on Operating System. The actor pattern’s actor is an “Elixir Process” in Elixir programming language.
An Elixir/Erlang Process
- runs on top of BEAM (Erlang Virtual Machine)
- has an address (pid)
- is a completely isolated process
- does not share memory
- communicates with other processes by messages
- has a private state (can be modified only private calculation functions / msg listeners)
- might have private message listeners(calculation functions) to process incoming messages from inside and outside
- has its own garbage collector
Elixir/Erlang Process’s Mailbox
Mailbox:
- receives internal and external messages asynchronously, so receiving a message does not block the sender of the message.
- passes messages to private listeners(calculation functions) of the process synchronously.
Elixir/Erlang Process’s State
State:
- is a private storage for the process
- only can be modified by that process
- when process dies, it goes back to initial value
Erlang VM inside OS
A zoom to big picture of a small Elixir Process.
Slides:
If you like the post, please recommend.