"Scott Hess" <[EMAIL PROTECTED]> wrote:
> "Matthew Dillon" <[EMAIL PROTECTED]> wrote:
> > :Unfortunately, I've found that having a group of processes reading
> > :from a group of socketpairs has better performance than having
> > :them all read from a single socketpair. I've been unable to
> > :determine why.
> >
> > The problem is that when you have N processes waiting on a single
> > socket and you write to the socket, all N processes will wake up even
> > though only one will get the data you wrote.
> <snip>
> > As an alternative to socket pairs, I would consider using SysV shared
> > memory and SysV semaphores.
>
> OK, so let's say I did spend some time implementing it in terms of
semget()
> and semop(). Would you be totally apalled if the performance turned out
to
> be about the same as using a single socketpair?
<snip>
>Unfortunately, I'll have to wait until tomorrow morning
>to rip things out and make a suitable example program for posting.
Find attached a new version of commtest.c which uses semaphores. I've also
placed a copy at http://www.doubleu.com/~scott/commtest.c. The performance
is identical enough that I'm guessing that semaphores must suffer from the
exact same problems as the single socketpair version.
Thanks,
scott
commtest.c