How to register a process in Erlang?

Total Post:107


 1213  View(s)
Rate this:
  1. How to register a process in Erlang?

    We can't always use Pids to communicate with processes because to use a Pid, process needs to be notified of it and store its value. So it is necessary to register a process.
    To register a process use register(Name, Pid) BIF, where Name is an atom and Pid is the process identifier. but for that we just need to know the process identifier.
    (After registering a process we can send messages on that process.)

    Some other BIFs that are also directly related to process registration for ex:
    unregister(Pid)  to unregister the Pid.
    registered()  it returns a list of registered names.
    whereis(Alias)  it returns the Pid associated with the Alias.

      Modified On Mar-28-2018 06:17:54 AM