Supervisor

Ulf Wiger etxuwig@REDACTED
Fri May 23 16:55:13 CEST 2003


On 23 May 2003, martin j logan wrote:

>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.

3. Look into using rest_for_one. If the supervisor starts
   FSM1, FSM2, and FSM3, in that order, FSM3, but not FSM1,
   will automatically be restarted if FSM2 dies.

/Uffe
-- 
Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson AB, Connectivity and Control Nodes




More information about the erlang-questions mailing list