What is a Supervisor REALLY doing?

Jeff Crane <>
Tue Aug 29 18:22:37 CEST 2006

I have no book and have taken no class. I'm in
southern california and have been fiddling with erlang
for a month. I understand the PURPOSE of a supervisor.
To monitor child(?) process states.

This is the only implementation of Supervisor
behaviour I can find (it's near the bottom).


Is this ms.erl an accurate representation of a
Supervisor implementation? 

I can't find any documentation for an erlang
supervisor. The examples I can find on the web:


(and with some digging, some others that are very
similar to this example). 

>From an erlang beginner's perspective this is a
completely uncomprehensible mechanism. For example:


-behaviour(supervisor). %% Why can't a I find the
actual implementation of this behaviour, defined line
by line so I understand what's going on?


start_link() -> %% Where, when, why would I call this?
All I know is that it starts the supervisor...I think
    supervisor:start_link(ch_sup, []). %% Where did
start_link/2 come from?

init(_Args) -> %% How and when is this called?
    {ok, {{one_for_one, 1, 60}, %% I have no idea
what's returning this or what the values are for
          [{ch3, {ch3, start_link, []},
            permanent, brutal_kill, worker, [ch3]}]}}.
%% I cannot understand what is going on here

When I have my own program, where I 

receiveLoop([]) ->
   Pid = spawn child,

child ->
   do stuff,

I can't understand how to add a supervisor without a
solid understanding of how they work. This is one of
many problems I have had trying to learn erlang. 

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the erlang-questions mailing list