Home > DeveloperSection > Interviews > How to register a process in Erlang?

Posted on    March-07-2016 12:57 AM

 erlang Concurrent Programming  erlang 
 1 Answer(s)
  278  View(s)
Rate this:

Tarun Kumar

Total Post:107

Posted on    March-07-2016 1:57 AM

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

Don't want to miss updates? Please click the below button!

Follow MindStick