OTP defines systems in terms of hierarchies of applications. An application consists of one or more processes. These processes follow one of a small number of OTP conventions, called behaviors. There is a behavior used for general-purpose servers, one for implementing event handlers, and one for finite-state machines. Each implementation of one of these behaviors will run in its own process (and may have additional associated processes). In this chapter we’ll be implementing the server behavior, called GenServer.
A special behavior, called supervisor, monitors the health of these processes and implements strategies for restarting them if needed.
We’ll take a look at these components from the bottom up—this chapter will cover servers, the next will explore supervisors, and finally we’ll implement applications.