5. Supervisor Behaviour
5 Supervisor Behaviour
This section should be read with the supervisor(3)
manual page in STDLIB, where all details about the supervisor behaviour is given.
5.1 Supervision Principles
A supervisor is responsible for starting, stopping, and monitoring its child processes. The basic idea of a supervisor is that it is to keep its child processes alive by restarting them when necessary.
Which child processes to start and monitor is specified by a list of child specifications
. The child processes are started in the order specified by this list, and terminated in the reversed order.
5.2 Example
The callback module for a supervisor starting the server from gen_server Behaviour
can look as follows:
-module(ch_sup). -behaviou