Processes and concurrency

A process is the unit of concurrency in Erlang: it owns a mailbox, runs a function, and talks to the rest of the system by messages. This part spawns one, links two, and watches a third with a monitor.

The second half goes inside: process_info shows the mailbox and the links, a selective receive picks the message it needs, a name lets a client find a server, and a request with a reference and a timeout turns two mailboxes into a conversation. The part closes with the shapes a concurrent program is built from: a pipeline, a pool and a collector.

8.1 Processes and message passing spawn, the mailbox, receive, and a pid as a value Open 8.2 Spawn and links spawn_link, the link, and the exit that travels it Open 8.3 Monitors and exits a monitor, the DOWN message, and the difference from a link Open 8.4 Processes in depth pid, process_info, links and monitors, and the exit signal Open 8.5 Selective receive a receive with patterns, a timeout, and after 0 Open 8.6 Process registry register, whereis, global, and a via name Open 8.7 Message protocols a request, a reference, a reply and the timeout Open 8.8 Concurrency patterns a worker pool, a pipeline, and fan-out with a collector Open

Lessons