About PIDs
Each Elixir process has its own unique identifier - a PID (process identifier).
- PIDs are their own data type.
- You can check if a variable is a PID with
is_pid/1
- You can get the current process's PID with
self()
.
- PIDs function as mailbox addresses - if you have a process's PID, you can send a message to that process.
- PIDs are usually created indirectly, as a return value of functions that create new processes, like
spawn
.
- PIDs should not be created directly by the programmer. If it were required, Erlang has a
list_to_pid/1
function.