20
Thomas Arts Erlang fault tolerance Processes can be linked to each other: PidAPidB Links are created by using either: link(Pid), or spawn_link(Module, Function, Args) Links are bi-directional. They can be removed using unlink(Pid).

21
Thomas Arts Erlang fault tolerance When a process terminates, an exit signal is sent to all processes the process is linked to: PidAPidBPidA A process can terminate normally, due to a run- time error, or when explicitly ordered to do so.

22
Thomas Arts Erlang fault tolerance PidCPidDPidEPidAPidB PidD If a process terminates abnormally, the emitted exit signal will (by default) cause the recipient to terminate: The termination reason in the transmitted exit signals will be the same as in the received one (the exit signal is propagated).

24
Thomas Arts Erlang fault tolerance A process can explicitly send an exit signal to another process using exit(Pid, Reason) : exit(PidB, error) PidBPidA error The calling process is not affected. The processes do not need to be linked.

25
Thomas Arts Erlang fault tolerance A process can trap exit signals using: process_flag(trap_exit, true). Incoming exit signals will be transformed into messages of the form: {'EXIT', Pid, Reason} These exit messages are delivered to the process mailbox in the normal way.