Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show all processes in Erlang?

Tags:

process

erlang

I need get all registered process. I input register(). a

 mnesia_event,kernel_safe_sup,mnesia_monitor,mnesia_snmp_sup,
 mnesia_recover,mnesia_late_loader,mnesia_kernel_sup,inet_db,
 rex,kernel_sup,global_name_server,mnesia_checkpoint_sup,
 file_server_2,user,error_logger,global_group,mnesia_locker,
 standard_error_sup,popd_listener_sup,pop_fsm_sup,dets_sup,
 smtpd_listener_sup,disk_log_sup,disk_log_server,dets|...]

How can i get all names registered process, without | ...] (truncation)?

Thank you.

like image 794
0xAX Avatar asked Mar 24 '11 05:03

0xAX


People also ask

What are Erlang processes?

Erlang processes are lightweight, operate in (memory) isolation from other processes, and are scheduled by Erlang's Virtual Machine (VM). The creation time of process is very low, the memory footprint of a just spawned process is very small, and a single Erlang VM can have millions of processes running.

What is PID in Erlang?

Every process in Erlang is identified by a unique process identifier (pid). The function self/0 returns the process identifier of the running process. Erlang processes can be created with any of the following functions: spawn, spawn link, spawn monitor, spawn opt, etc.

Which module is used to spawn processes manually in Erlang?

spawn() creates a new process and returns the pid. The new process starts executing in Module:Name(Arg1,...,ArgN) where the arguments are the elements of the (possible empty) Args argument list.

How do you exit a process in Erlang?

A process can terminate itself by calling one of the BIFs exit(Reason), erlang:error(Reason), erlang:error(Reason, Args), erlang:fault(Reason) or erlang:fault(Reason, Args). The process then terminates with reason Reason for exit/1 or {Reason,Stack} for the others.


2 Answers

> rp(registered()). Documentation here

like image 200
D.Nibon Avatar answered Oct 13 '22 09:10

D.Nibon


registered() is returning all the processes, but the shell is truncating output.

you can print the result to see everything:

io:format("~p~n", [registered()]).
like image 24
butter71 Avatar answered Oct 13 '22 10:10

butter71