[erlang-questions] Purpose of supervising temporary children?

Garrett Smith g@REDACTED
Thu Feb 25 18:51:03 CET 2010


On Thu, Feb 25, 2010 at 11:26 AM, David Mercer <dmercer@REDACTED> wrote:
> What is the purpose of supervising temporary children?  I know you're not
> supposed to have rogue unsupervised processes running around in your OTP
> system, but is there that much danger in having such rogue processes if they
> are linked to supervised processes?  Is the supervisory role just smoothing
> off some of the rough corner cases of plain old linked processes, or is
> there more to it than that?

In the case of simple_one_for_one, you get house keeping -- a
temporary process will be automatically removed from the supervisor's
list of children when it terminates, regardless of exit status. This
lets you use the supervisor as both a factory and an inventory
(which_children) of a certain type/category of process.

I've gotten into the habit of religiously using supervisors to create
processes. There's probably more advanced patterns, but I find my code
can get messy with process management tasks when I don't use
supervisors.

Garrett


More information about the erlang-questions mailing list