Re: interprocess messaging to/from many grandchildren
phil-news-nospam_at_ipal.net
Date: 08/05/03
- Next message: William Ahern: "Re: dlopen portability"
- Previous message: Sam Zoghaib: "nftw(3) and FTW_D"
- In reply to: Marc Rochkind: "Re: interprocess messaging to/from many grandchildren"
- Next in thread: Michael B Allen: "Re: interprocess messaging to/from many grandchildren"
- Reply: Michael B Allen: "Re: interprocess messaging to/from many grandchildren"
- Reply: Eric Sosman: "Re: interprocess messaging to/from many grandchildren"
- Reply: Gene Hightower: "Re: interprocess messaging to/from many grandchildren"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 5 Aug 2003 00:52:18 GMT
On Mon, 04 Aug 2003 16:54:56 -0600 Marc Rochkind <rochkind@basepath.com> wrote:
| On 4 Aug 2003 20:55:55 GMT, <phil-news-nospam@ipal.net> wrote:
|
|> I want to have a large number of child processes communicating
|> with a grandparent process. The number of children may be larger
|> than the number of file descriptors a process can have, so I do
|> need to rule out having separate pipes to each child. Further,
|> since it is the grandparent doing the communications, setting up
|> pipes in the middle process (child of the grandparent) which is
|> doing the network listen and forking each child, will be hard to
|> do, anyway. Byte stream pipes will also not be good because the
|> messages need to stay intact and not be mingled with other messages
|> coming from other children, while they may be larger than the
|> maximum a pipe can convey without that risk. And finally, the
|> grandparent needs to send messages back and be sure the correct
|> child gets it. I will not be using threads.
|>
|> What is the best way to do this? What is the 2nd best way? It
|> does not need to be super portable, but it must work on Linux and
|> should work on the BSDs and Solaris.
|>
|
| For small messages -- a couple of hundred bytes or fewer -- SysV messages
| will probably be fastest, and are very easy to set up.
|
| For large messages, shared memory + semaphores will be fastest.
The messages could be as much as 64K bytes. Sharing memory could be a
problem because of the large number of children, and stuffing that many
shared spaces into the grandparent process VM.
| However, be warned that the so-called "semaphore initialization solution"
| that Stevens describes doesn't work on FreeBSD (and possibly on other BSD
| systems) because their implementation doesn't properly set the times.
I'm really wanting to avoid semaphores of any kind. Shared memory plus
signals might work, if I can address the sharing problems effectively
(which I have doubts about).
| Also, one quasi-BSD system, Darwin, doesn't have SysV messages.
Darwin is not a big concern. It's a server application.
| Best of all is to encapsulate the actual mechanism in a wrapper so you can
| try alternatives once the application is running.
Hopefully I can do that. I'm starting to think at the moment to use UDP
bound to the localhost address. But each child will have to have its own
localhost port (the port would then by the identity of the child), and
that could be using up a lot of them. The grandparent needs to be able
to respond to the correct child, but it doesn't need to know it's PID.
I'm also going to think about some other models to do this instead of the
GP/P/C relationship I have now.
-- ----------------------------------------------------------------------------- | Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ | | (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ | -----------------------------------------------------------------------------
- Next message: William Ahern: "Re: dlopen portability"
- Previous message: Sam Zoghaib: "nftw(3) and FTW_D"
- In reply to: Marc Rochkind: "Re: interprocess messaging to/from many grandchildren"
- Next in thread: Michael B Allen: "Re: interprocess messaging to/from many grandchildren"
- Reply: Michael B Allen: "Re: interprocess messaging to/from many grandchildren"
- Reply: Eric Sosman: "Re: interprocess messaging to/from many grandchildren"
- Reply: Gene Hightower: "Re: interprocess messaging to/from many grandchildren"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|