HOW TO REGISTER A PROCESS IN ERLANG?

Tarun Kumar

Total Post:107

Points:535
Posted by  Tarun Kumar
 590  View(s)
Ratings:
Rate this:
  1. Tarun Kumar

    Post:107

    Points:535
    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-07-2016 01:22:22 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!