Elixir Functions to Manage Processes
An explanation of the function mix.new that Elixir uses to manage processes.
We'll cover the following
Let’s peek under the hood at a few of the basic functions Elixir uses to manage processes. We will look at two of the building blocks that go into OTP:
-
Process creation through
spawn_link/1
. -
Notification through
Process.monitor/1
.
We won’t use those functions directly as we build out Mastery, but knowing how they work will help you understand how OTP supervisors work. First, let’s start at the beginning, with mix new
.
Mix projects define applications
When we type mix new
, we’re defining a project. At this point, we need to introduce that ambiguous overloaded word we mentioned previously: application. We told you that we’d use it only when we have to. In this section, we’re using the term in a specific sense. An application, in this sense, is a way to package software for OTP.
Applications have certain specifications. Here’s the one for Mastery – Elixir places the compiled structure inside the _build
directory. We can peek inside /_build/dev/lib/mastery/ebin/mastery.app
:
Get hands-on with 1400+ tech skills courses.