An OTP-compliant process follows OTP conventions, participates in supervision trees, and provides richer lifecycle and error behavior than a plain process started with spawn. Production systems generally use OTP-compliant processes rather than unmanaged spawned processes. section 6.2.7 section 10.0
Common ways to run OTP-compliant processes include:
- GenServer provides the central OTP abstraction for many stateful and message-driven processes. section 6.2.7
- Supervisor organizes workers into restartable supervision trees. section 9.1.6
- Registry starts compliant processes that can be placed in supervision trees. section 9.1.6
- Task suits one-off jobs, while Agent suits simple processes whose main purpose is managing and exposing state. section 6.2.7 section 10.0
- GenStage and Phoenix.Channel extend the pattern toward back pressure, load control, and bidirectional client communication. section 6.2.7
Choosing a supervised worker
A one-off input-processing job can run as a Task; a state manager can use an Agent; a more capable message-driven worker can use GenServer. Each can be started under supervision instead of using spawn_link directly. section 6.2.7 section 9.1.6
Use the supervision-tree figure to see how compliant workers are organized and how failures are contained or propagated upward. section 9.1.6
