[erlang-questions] Logic in the supervisor?

Mike Oxford moxford@REDACTED
Sat Apr 9 02:05:23 CEST 2011


I have a pool of resources, say 10k children(FSMs) each holding a resource.

If I want to remove a resource from the pool, of which they may be
duplicates, I have two options.

1)  Walk the list of children and tell each one "hey, if this is you, close
up shop."
2)  Maintain a dict/ETS of all resources, which has more run-time overhead
and a higher likelyhood
     of "something happening."

If the supervisor dies, all resources are shut down as they're children, so
having the supervisor maintain
the dict/ETS is an option.

Having another FSM outside the call-tree maintaining that status is an
option but, in the case of that
FSM going down then all resources are "lost" and should be released....which
minics the case of
a supervisor going down..

So...
Do I maintain state external to the supervisor or..
Have the supervisor maintain state or...
Just deal with the message-storm on resource removal?

Thanks!

-mox
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110408/441f0155/attachment.htm>


More information about the erlang-questions mailing list