Creating Links

Imagine we have a set of unrelated processes; this is shown on the left side of the following figure. The links are represented by dashed lines.

images/procs1.png

To create links, we call the primitive link(Pid), which creates a link between the calling process and Pid. So, if P1 calls link(P3), a link is created between P1 and P3.

After P1 calls link(P3), P3 calls link(P10), and so on, we arrive at the situation shown on the right side of the figure. Note that the link set of P1 has one element (P3), the link set of P3 has two elements (P1 and P10), and so on.

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.