[dmd-concurrency] Shutdown protocol

Michel Fortin michel.fortin at michelf.com
Wed Jan 20 10:41:55 PST 2010


Le 2010-01-20 à 12:30, Sean Kelly a écrit :

> Perhaps this shutdown protocol is the reason for spawn_linked in erlang?  Last week, Andrei and I were trying in vain to come up with a use case for bidirectional linking.

Here's what I found about that:

"""
7.3	Linked Processes

Processes can monitor each other’s behaviour. This can be described in terms of two concepts, process links and EXIT signals. During execution, processes can establish links to other processes (and ports, see Section ??). If a process terminates (normally or abnormally), a special EXIT signal is sent to all processes (and ports) which are currently linked to the terminating process. This signal has the following format:

	{’EXIT’, Exiting_Process_Id, Reason}

The Exiting_Process_Id is the process identity of the terminating process. Reason is any Erlang term.

On receipt of an EXIT signal in which the Reason is not the atom normal the default action of the receiving process is to terminate and send EXIT signals to all processes to which it is currently linked. EXIT signals where Reason is the atom normal are, by default, ignored.

The default handling of EXIT signals can be overridden to allow a process to take any required action on receipt of an EXIT signal (see Section ??).
"""

From Concurrent programming in Erlang, part 1, section 7.3. PDF available here: <http://www.erlang.org/doc.html>):

Note that this is in the Error Handling chapter. It looks like linked processes only stop when a process stops with an error, unless there is a custom handler that does otherwise. It's not as drastic as our shutdown protocol.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the dmd-concurrency mailing list