[comp.lang.c++] A question about run time binding.

ssr@taylor.Princeton.EDU (Steve S. Roy) (07/17/90)

This came up writing a code that needs to do a possibly remote
procedure call as efficiently as possible in a Hypercube.  There is a
network of "nodes" which do computation and talk to other "nodes"
across "links".  There are typically many nodes on each "processor"
and that provides fast "communication" among those nodes, but if a
node needs to talk to someone on another processor, a remote procedure
call is invoked.

When I want another node to do a computation with data that I have, I
would like to say:

	this_node.FindOtherNode().DoComputation(data)

where this_node is the current node, FindOtherNode decides whether the
other node is near or far and then returns a type that DoComputation
uses to either do a calculation on this processor using data or send a
message (including the data) to another processor to do a calculation.

As I understand things, FindOtherNode would have to return a structure
general enough to include either a near node reference or a far node
reference (potentially very different) and a boolean which
DoComputation could use for an if statement.

Is this correct?  I can see that you could write by hand a union that
includes the two (or more) possible classes plus the flag and test it
yourself, it would just be nice if the compiler would do that for me.
It seems like much of the point of C++ (and OO in general) is to avoid
forcing the user to branch on a flag that indicates the type of an
object.

Steve Roy
ssr@acm.princeton.edu

rfg@NCD.COM (Ron Guilmette) (07/19/90)

In article <1249@idunno.Princeton.EDU> ssr@taylor.Princeton.EDU (Steve S. Roy) writes:
>
>This came up writing a code that needs to do a possibly remote
>procedure call as efficiently as possible in a Hypercube.  There is a
>network of "nodes" which do computation and talk to other "nodes"
>across "links".

Hummm.... Sounds like your basic generic description of your basic generic
loosely-coupled multiprocessor.

If you want to see how at least one group has used (and extended) the C++
language to do some really clever things in a loosely-coupled multiprocessor
environment, I suggest that you call MCC in Austin Texas and ask to speak
to the ES-kit project secretary (Marquita Wanslow).  Ask her to send you
the papers that deal with the software design of the ES-kit project.

P.S.  The ES-kit hardware design is pretty interesting too.

-- 

// Ron Guilmette (rfg@ncd.com)
// C++ Entomologist
// Motto:  If it sticks, force it.  If it breaks, it needed replacing anyway.