[erlang-questions] Why Erlang spawns sub-processes in their own process session / group?

Ciprian Dorin Craciun <>
Tue Oct 27 19:19:16 CET 2015

Today I observed that the processes spawned by RabbitMQ (like for
example EPMD in non-detached mode, system supervisor processes like
disk, etc.) are put in different process sessions / groups than the
"parent" Erlang VM process.

Thus I tracked down the `setgrp` / `setsid` calls to one of the two places:
* `erts/emulator/sys/unix/erl_child_setup.c` (`main`) -- which is my
understanding is a process launcher that bootstraps the process to be
* `erts/emulator/sys/unix/sys.c` (`spawn_start`) -- which I gather is
used to spawn new port drivers;
* (a few other places, but there the calls were made when the process
has daemonized in the background;)

I wonder why such a decision to put newly spawned processes in new
sessions / groups than the parent Erlang VM?  What is the advantage?

Because I definitely can find disadvantages, like for example being
quite hard to kill an entire Erlang-based application, together with
all the sub-processes by using the `kill` syscall with a group PID
instead of a process PID.


More information about the erlang-questions mailing list