Tasks

Learn about tasks and their supervision in Elixir.

We'll cover the following...

This part of the course is about processes and process distribution. So far, we’ve covered two extremes. In the initial chapters, we looked at the spawn primitive, along with message sending and receiving and multimode operations. Later, we looked at OTP, the juggernaut of process architecture.

Sometimes, though, we want something in the middle. We want to be able to run simple processes, either for background processing or for maintaining state. But we don’t want to be bothered with the low-level details of spawn, send, and receive, and we really don’t need the extra control that writing our own GenServer gives us.

Enter tasks and agents, which are two simple-to-use Elixir abstractions. These use OTP’s features but insulate us from these details.

Tasks

An Elixir ...