Message passing between processes

After the initial contact with Elixir, when we start building applications with some degree of complexity, we frequently need our concurrent processes to cooperate with one another. As we've previously stated, processeses don't share memorythey communicate by passing messages back and forth. These messages contain Elixir termsbasically anything you can store in a variable can be sent in a message.

The sending of the message consists of storing it in the receiver's mailbox. The mailbox of a process is unboundedhowever, in practice, it is bounded by the available memory. Let's now see this in action, by sending a message to ourselves in the shell process. To send a message, you use the Kernel.send/2 function, ...

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.