master/slave process relationship

master/slave process relationship

Post by kani » Fri, 27 Sep 2002 13:12:17



Hi all,
I working on an application on linux which involves creating redundant
processes for high availability. roughly it is something like this:

clients-->Process A------> Process B--->Process C
the requirement is that each process A,B,C should have a slave process to
take over in case something happen to it. so, my quesion is: how should i
go about creating slave processes ? should they the same as the master
processes but with a flag to indicate that they are slaves, and once they
take over change the flag to indicate that they are the masters now and
create new slave processes ? how about the communication between the master
and the slave ?

I just need pointers in the right direction.

thanx
mark

 
 
 

master/slave process relationship

Post by Kasper Dupon » Fri, 27 Sep 2002 15:02:44



> Hi all,
> I working on an application on linux which involves creating redundant
> processes for high availability. roughly it is something like this:

> clients-->Process A------> Process B--->Process C
> the requirement is that each process A,B,C should have a slave process to
> take over in case something happen to it.

Forget it!

What could happen to the process?

1) It could die because of a hardware failure. In that case
   it doesn't help to have another process on the same
   hardware.

2) It could die because of a bug in your program. In that
   case you are in trouble anyway. Adding complexity to your
   program is not going to decrease the number of bugs.

3) It could die because you kill the process. Well, don't
   do that.

--
Kasper Dupont -- der bruger for meget tid p? usenet.



 
 
 

master/slave process relationship

Post by Kevin Easto » Fri, 27 Sep 2002 23:53:18



> Hi all,
> I working on an application on linux which involves creating redundant
> processes for high availability. roughly it is something like this:

> clients-->Process A------> Process B--->Process C
> the requirement is that each process A,B,C should have a slave process to
> take over in case something happen to it. so, my quesion is: how should i
> go about creating slave processes ? should they the same as the master
> processes but with a flag to indicate that they are slaves, and once they
> take over change the flag to indicate that they are the masters now and
> create new slave processes ? how about the communication between the master
> and the slave ?

> I just need pointers in the right direction.

The way I'd go about this is, for one such process A, have a
"supervisor" process, and the "worker" process.  The supervisor process
is the first process started.  It forks off a child, which becomes the
worker, then waits for the child to die.  When this happens, it forks
off another child to replace the previous one... lather, rinse, repeat.

        - Kevin.

 
 
 

master/slave process relationship

Post by Sundial Service » Sat, 28 Sep 2002 09:17:34




>> Hi all,
>> I working on an application on linux which involves creating redundant
>> processes for high availability. roughly it is something like this:

>> clients-->Process A------> Process B--->Process C
>> the requirement is that each process A,B,C should have a slave process to
>> take over in case something happen to it. so, my quesion is: how should i
>> go about creating slave processes ? should they the same as the master
>> processes but with a flag to indicate that they are slaves, and once they
>> take over change the flag to indicate that they are the masters now and
>> create new slave processes ? how about the communication between the
>> master and the slave ?

>> I just need pointers in the right direction.

> The way I'd go about this is, for one such process A, have a
> "supervisor" process, and the "worker" process.  The supervisor process
> is the first process started.  It forks off a child, which becomes the
> worker, then waits for the child to die.  When this happens, it forks
> off another child to replace the previous one... lather, rinse, repeat.

I wouldn't do it quite that way.  I'd have a supervisor and one or more
workers, but instead of letting the child die-off after completing a unit
of work, I'd let it wait for more work to do (or for a signal to die).
Creating and destroying processes is expensive.