OTP behaviours¶
Category: Communication · Status: stub · Lessons: chapter 05, Message passing (planned)
One line: Erlang/OTP's reusable process patterns — a generic server, a supervisor, an application — where the library owns the concurrency and your module supplies the callbacks.
Also called: gen_server, GenServer, OTP.
How it connects¶
flowchart LR
n_actor_model["Actor model"]
n_otp_behaviours["OTP behaviours"]
n_supervision["Supervision"]
n_otp_behaviours -->|uses| n_actor_model
n_otp_behaviours -->|uses| n_supervision
classDef center stroke-width:3px
class n_otp_behaviours center
classDef outside stroke-dasharray: 4 3
class n_actor_model,n_supervision outside
- Is built on: Actor model, Supervision
In each language¶
| Erlang and Elixir | gen_server ↗ in Erlang and GenServer ↗ in Elixir |
Where to read more¶
- In the books: Erlang Programming, Francesco Cesarini, Simon Thompson — ch. 12, 'OTP Behaviors'
- In the books: Programming Elixir ≥ 1.6, Dave Thomas — ch. 17, 'OTP: Servers'
- In the books: Programming Erlang, Joe Armstrong — ch. 22, 'Introducing OTP'
- In the books: Erlang and OTP in Action, Martin Logan, Eric Merritt, Richard Carlsson — ch. 1, 'The foundations of Erlang/OTP'
- In the books: Introducing Elixir, Simon St. Laurent, J. David Eisenberg — ch. 12, 'Getting Started with OTP'
- Reference: Erlang/OTP: Design Principles ↗