1. Overview

1 Overview

The OTP design principles define how to structure Erlang code in terms of processes, modules, and directories.

1.1 Supervision Trees

A basic concept in Erlang/OTP is the supervision tree. This is a process structuring model based on the idea of workers and supervisors:

  • Workers are processes that perform computations, that is, they do the actual work.
  • Supervisors are processes that monitor the behaviour of workers. A supervisor can restart a worker if something goes wrong.
  • The supervision tree is a hierarchical arrangement of code into supervisors and workers, which makes it possible to design and program fault-tolerant software.

In the following figure, square boxes represents supervisors and circles represent workers:

Figure 1.1: Supervision Tree

登录查看完整内容