Menu

Erlang Explained: Processes That Fail and Restart
📰

Erlang Explained: Processes That Fail and Restart

DEV Community: beginners·The Practical Developer·9 days ago
#MB7zjoKb
#devtobeginners#devto#dev#process#erlang
Reading 0:00
15s threshold

Erlang was built for telephone switches, systems that were expected to run for years without stopping. Its answer to failure was unusual: do not try to prevent every crash. Let a process fail, notice the failure, and start a fresh process in its place. The system as a whole keeps running because no single failure takes everything down.

The unit of work in Erlang is a process, and it is far lighter than an operating system process. A program can run thousands or millions of them. Processes do not share memory. They communicate by sending messages to each other, and each process handles its own mailbox in turn. That isolation is the point. A bug in one process cannot silently corrupt another process's state, because there is no shared state to corrupt.

Here is a small example. It spawns a new process that prints a greeting, while the calling function returns ok straight away.

- module ( greet ).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.