|
Home > Archive > Unix Programming > April 2004 > Want something like a pipe with multiple readers and/or multiple
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Want something like a pipe with multiple readers and/or multiple
|
|
| Brady Montz 2004-04-28, 1:35 pm |
| 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.
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.
--
Brady Montz
bradym@balestra.org
| |
| Chuck Dillon 2004-04-28, 2:34 pm |
| 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.
|
|
|
|
|