Search⌘ K
AI Features

Linking Processes in Supervision

Explore how linking processes and trapping exits form the core mechanisms behind Elixir supervisors. Understand how linked processes communicate crash signals and how trapping exits allows supervisors to manage failures without crashing. Practice sending and receiving messages in IEx to deepen your grasp of these concepts.

We'll cover the following...

Supervision

Supervisors may sound magical, but there are two simple, practical mechanisms behind their magic: linking processes and trapping exits. We’ll see how they work together to make supervisors work.

The key to process supervision is for one process to be able to link to other processes and know when those other processes crash. Beyond that, the supervising process needs to keep running if it gets crash notifications from the linked processes.

When one process in a group of linked processes crashes, it sends a special message called an exit signal to all its the other linked processes. Any process that receives an exit signal will also exit and send an ...