Registered Processes

If we want to send a message to a process, then we need to know its PID, but when a process is created, only the parent process knows the PID. No other process in the system knows about the process. This is often inconvenient since the PID has to be sent to all processes in the system that want to communicate with this process. On the other hand, it’s very secure; if you don’t reveal the PID of a process, other processes can’t interact with it in any way.

Erlang has a method for publishing a process identifier so that any process in the system can communicate with this process. Such a process is called a registered process. There are four BIFs for managing registered processes.

register(AnAtom, Pid)

Register the process ...

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.