[Spread-users] Spread and fork ()

Ryan Caudy rcaudy at gmail.com
Tue Nov 23 00:22:27 EST 2004


Well, the issue with fork is that you get a copy of the file
descriptors, in this case each 'pointing' to the same socket.  If you
provide consistency control (mutual exclusion/serialization, with some
form of ipc) at the Spread interface level (i.e. no two SP_receives at
the same time), you could use the Spread connection in multiple
processes safely (I think).

Semantically, though, it's not quite the same.  You would receive each
message only once per connection, not once per process.  Although the
messages will be delivered according to the normal ordering
guarantees, this doesn't necessarily guarantee processing in the same
order.  For example, mailbox m is shared by processes A and B.  Two
agreed messages c and d are sent on mailbox n.  Say process A receives
c on mailbox m, and is scheduled off the processor.  Then, process B
receives d, and does whatever application-level processing you have. 
Then, A gets the CPU and processes c.

For this reason, if you *really* need the ordering semantics, you
would probably end up with an unacceptably low degree of concurrency,
and no real benefit to having multiple processes.

In terms of the membership model (your actual question), the issue is
that one process using the mbox would join or leave a group, or
disconnect the mbox, for all.  Only one process would get the
membership messages, also, and the same process might not necessarily
get both the transitional signal and the regular membership message. 
If one process exits, though, the socket *wouldn't* closed.

So, to me, it's hard to see an application where you would really
benefit from sharing one mbox in multiple processes.  I'd be
interested to know about your application.

Cheers,
Ryan


On Mon, 22 Nov 2004 14:09:38 -0800, J C Lawrence <claw at kanga.nu> wrote:
> 
> On Mon, 22 Nov 2004 20:59:15 +0000
> Matt Sergeant <matt at sergeant.org> wrote:
> > On 22 Nov 2004, at 19:52, J C Lawrence wrote:
> 
> >> Am I correct in assuming that Spread's membership model won't be
> >> happy under fork()?
> 
> > Seems to be more stable to connect to the spread daemon in each
> > child.
> 
> Yeah, that's what I've seen, and is why I'm currently doing
> disconnect/fork/connect.  However at this point I'm interested in the
> "correct" behaviour.
> 
> 
> 
> --
> J C Lawrence
> ---------(*)                Satan, oscillate my metallic sonatas.
> claw at kanga.nu               He lived as a devil, eh?
> http://www.kanga.nu/~claw/  Evil is a name of a foeman, as I live.
> 
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users
> 


-- 
---------------------------------------------------------------------
Ryan W. Caudy
<rcaudy at gmail.com>
---------------------------------------------------------------------
Bloomberg L.P.
<rcaudy1 at bloomberg.net>
---------------------------------------------------------------------
[Alumnus]
<caudy at cnds.jhu.edu>         
Center for Networking and Distributed Systems
Department of Computer Science
Johns Hopkins University          
---------------------------------------------------------------------




More information about the Spread-users mailing list