Supervisor

martin j logan martin@REDACTED
Fri May 23 16:04:40 CEST 2003


On Fri, 2003-05-23 at 03:12, Inswitch Solutions - Erlang Evaluation
wrote:
>  
> I have three FSM machines FSM1, FSM2 and FSM3.
> FSM1 creates FSM2 (linked) and FSM3 uses FSM2 (linked).

It is best to have supervisors create all of your workers. If you can
structure your processes this way go ahead and do it. It should not be a
problem if fsm2 is a long lived process.  
>  
> Whenever FSM2 exit I'd like FSM1 to re-create FSM2 again, so FSM3 uses
> FSM2 continously.

I don't know the specifics of your problem but it sounds like it would
be suited to one of two supervision strategies. 

1. One supervisor with a one_for_one strategy. Start the FSMs in the
following order: FSM1, FSM2, FSM3.

2. A two tier supervision structure. Tier one with a one_for_one
strategy. First start a second supervisor next start FSM3. The second
supervisor starts, with a one_for_all strategy, FSM1 then FSM2. The
chronological order for process creation under this scheme is 1. top
level supervisor, 2. second tier supervisor, 3. FSM1, 4. FSM2, 5. FSM3.

>  
> Questions:
> 1 - Can I use supervisor behavior in this case ?
Yes
> Are there any examples of supervisor usage to look for ?
> 2 - Is it easier to trap EXIT signals ?
No


>  
> Many thanks,
> Eduardo Figoli
> INSwitch Solutions
>  
>  
>  
>  
>  
-- 
martin j logan <martin@REDACTED>




More information about the erlang-questions mailing list