GenServer

We know by now that the Erlang VM lets millions of processes live happily on their own, and communicating with them is only possible via message exchange, which is the process of enqueueing messages on each process mailbox.

This interaction between processes can be seen as a client-server interaction, in the sense that a process asks the other, by enqueuing a message on its mailbox, to do something on its behalf. To implement the service, the server process would have to devise its receive loop, passing around its internal state, handling unexpected messages, and so on. While implementing the server-side logic, one also has to think in advance of possible edge cases that may corrupt the server's internal state or place it in a deadlock ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.