Supervisor
Supervisors are one of the most important features of OTP. They monitor other processes and take action if anything goes wrong, restarting the failed process or possibly escalating the problem to a higher level. Layering supervisors into supervision trees allows you to create highly fault-tolerant systems. (Logan, Merritt, and Carlsson 2010)
The Supervision Tree
A supervision tree is a tree of processes. The upper processes (supervisors) in the tree monitor the lower processes (workers) in the tree and restart the lower processes if they fail. (Armstrong 2013, 398)
There are two types of supervision trees:
one_for_one
- If one process crashes, it is restarted.

one_for_all
- If one process crashes, all others are terminated and then restarted as well.

Independent of what the monited application does, a supervisor
works is always
the same can be divided into two categories:
- A generic part that deals with starting, monitoring and restarting child processes.
- A specific part that consists of the specification of how the children are supposed to be started and restarted.
Robust Systems
In Erlang, you build robust systems by layering. Using processes, you create a tree in which the leaves consist of the application layer that handles the operational tasks while the interior nodes monitor the leaves and other nodes below them, (…). Processes at any level will trap errors occurring at a level immediately below them. A process whose only task is to supervise children—in our case the nodes of the tree—is called a supervisor. A leaf process performing operational tasks is called a worker. When we refer to child processes, we mean both supervisors and workers belonging to a particular supervisor.