[erlang-questions] supervisor children's pid

Roberto Ostinelli <>
Wed May 18 11:26:54 CEST 2011

> > }  is this the best strategy to achieve this?
> >
> > Yes, use supervisor:which_children/1 to learn the siblings.
> No, if he's using anything other than one_for_all strategy the Pids
> he learns this way may become stale in the future.

fortunately, it is a one_for_all strategy, but good point.

Usual ways to handle this:
>  * Register the processes, if the names need to be dynamic supervisor
>    can compute them at init/1 and pass to children in arguments.

no can do, these have to be anonymous.

>  * Run a name resolution server somewhere and have all the children
>    subscribe to it. The server will monitor them and may provide
>    notification facility to announce Pid changes/availability to
>    anyone interested -- this lets you do safe startup of dependent
>    processes.

probably the best would be then to have a gen_event module for this. this is
a good idea.

>  * In some cases, you'd start_link those child processes from one
>    master server directly (not from supervisor), and use their Pids
>    directly. Only makes sense if they're very closely bound.

i'm adding supervisors because i need it to be as OTP compliant as possible,
so I'm actually moving away from this solution.

thank you very much vance and jachym for these insights.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110518/8963fb75/attachment.html>

More information about the erlang-questions mailing list