link(Pid) - Set a bi-directional link
between the current process and the
process Pid

process_flag(trap_exit, true) - Set the
current process to convert exit signals to
exit messages, these messages can then
be received in a normal receive statement.

exit(Reason) - Terminates the process
and generates an exit signal where the
process termination information is Reason.

What really happens is as follows: Each
process has an associated mailbox -
Pid ! Msg sends the message Msg to the
mailbox associated with the process Pid.

The receive .. end construct attempts to
remove messages from the mailbox of the
current process. Exit signals which arrive at
a process either cause the process to crash (if
the process is not trapping exit signals) or
are treated as normal messages and placed in
the process mailbox (if the process is trapping
exit signals). Exit signals are sent
implicitly (as a result of evaluating a BIF
with incorrect arguments) or explicitly
(using exit(Pid, Reason), or exit(Reason)
).

If Reason is the atom normal - the
receiving process ignores the signal (if it is
not trapping exits). When a process terminates
without an error it sends normal exit
signals to all linked processes. Don't say you didn't ask!

This is the top loop of an allocator with no
error recovery. Free is a list of unreserved
resources. Allocated is a list of pairs
{Resource, Pid} - showing which resource
has been allocated to which process.