Re: Want something like a pipe with multiple readers and/or multiple writers

From: Chuck Dillon (spam_at_nimblegen.com)
Date: 04/28/04


Date: Wed, 28 Apr 2004 13:43:16 -0500

Brady Montz wrote:

> I've got a distributed app where there's a master process, and a bunch
> of slaves. All running on the same machine. The master process
> periodically needs to messages to the slaves, and they periodically
> need to send messages back.
>
> The master doesn't need to know how many slaves there are, or to
> distinguish between them.

The critical issue is the synchronization requirement characteristics
of the messaging mechanism. Must every message be recieved? Must the
writer block (be synchronized) until the reader gets the message? Must
the writer never block? If all messages must be received and the
master can't block what's the minimal amount of data that the system
must be able to buffer? Can the slaves block and wait for messages or
must they receive an asynchronous event or poll? What about the master?

You can build systems like this using various combinations of:
        a) Sockets
        b) Message Queues
        c) Shared Memory and Semaphores
        d) Files
        e) Named Pipes (FIFOs)
        f) Signals
        g) X Windows events (Is this an X GUI app?)
        h) others that don't come to mind right now

Which is the way to go depends on the answers to the above questions.

-- ced

Where's tooltalk when you need it? ;-)

>
> Ideally, what I would like is something like a pipe or socket where
> when the master writes a message to it, all the slaves get a copy on
> their end. And, similarly, a single file descriptor the master can
> read from, with a well known address, where any slave could write to
> it and have the master see the message.
>
> Finally, this needs to be portable across various unixes.
>
> I kinda doubt that the basic pipes or sockets can do this, but I might
> as well ask: can they? And if not, then is there some library or
> toolkit somewhere that provides this?
>
> Thanks.
>

-- 
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.


Relevant Pages