Chapter 12Concurrent Programming
Writing concurrent programs is easy once we know sequential
Erlang. All we need are three new primitives:
spawn, send, and
receive. spawn
creates a parallel
process. send
sends a message to a process, and
receive receives messages.
Erlang concurrency is based on processes. These are small, self-contained virtual machines that can evaluate Erlang functions.
I’m sure you’ve met processes before, but only in the context of operating systems. In Erlang, processes belong to the programming language and not the operating system. This means that Erlang processes will have the same logical behavior on any operating system, so we can write portable concurrent code that can run on any operating system that supports ...
Get Programming Erlang, 2nd Edition 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.