[comp.lang.eiffel] Inter-Process Communication

cwc@cs.Princeton.EDU (Chris Clifton) (06/09/90)

Has anyone written any sort of inter-process communication
primitives in Eiffel?  Preferably something based on UNIX
sockets (I'd also like inter-processor communication eventually.)
I'd be interested in hearing experiences and getting suggestions,
even if you aren't in a position to share actual code.

Thanks-
-Chris Clifton (cwc@Princeton.EDU)

brian@babbage.csus.edu (Brian Witt) (06/11/90)

In article <230@rossignol.Princeton.EDU> cwc@cs.Princeton.EDU (Chris Clifton) writes:
>Has anyone written any sort of inter-process communication
>primitives in Eiffel?  Preferably something based on UNIX
>sockets (I'd also like inter-processor communication eventually.)
>I'd be interested in hearing experiences and getting suggestions,
>even if you aren't in a position to share actual code.

For a class project, a friend and I created
several classes to provide inter-nodal communications on
an Intel HyperCube/1.  Since the HyperCube/1 is 16-bit and Eiffel is 32-bit,
we ran the code on a simulator.  We created two class pairs; one a high level
interface, and another a low level interface.  The high level provided
functions like send-message and get-message.  Basic nodal routing was
provided.  These routines called methods in the low-level portion
that actually got the work done.  The goal here was to create something
that was independent of the OS functions.

The other class pair concerned messages.  Our messages were like
postal envelopes: they contained some data, and routing instructions.
There was an input buffer and an output buffer.
The user's application had to copy out of these buffers to use the
data, since doing  ringleft.receive  overwrote the contents of the
buffer.

Our goal of OS independent messaging on arbitrary parallel processing
topologies was easily acheived.  Tony (my partner who wrote these
interface routines) said Eiffel ensured he wrote correct code, and
the system worked stright out.  The pre- and post-conditions helped
out tremendously.  Multiple inheritance allowed us to create message
classes that could message (from one class), and also know about
a topology (another class).

We also created a feature that allowed us to peek into the actual
storage of an ARRAY object.  It's very nasty, and I won't force
it on anyone -- mail if you'd like a copy.  maybe I'll post it
if I feel brace enough.  It is _very_ nasty.


>Thanks-
>-Chris Clifton (cwc@Princeton.EDU)

--- brian (now with better objects) witt
brian@babbage.ecs.csus.edu   -or-  seer.UUCP!rael!aleks

paj@mrcu (Paul Johnson) (06/15/90)

>Has anyone written any sort of inter-process communication
>primitives in Eiffel?  Preferably something based on UNIX
>sockets (I'd also like inter-processor communication eventually.)
>I'd be interested in hearing experiences and getting suggestions,
>even if you aren't in a position to share actual code.

I am currently working on the problems raised by distributed systems
and object oriented programming.  One of the major principles is that
the distribution and resulting concurrency should be transparent: it
should not matter to the application programmer whether a process is
running in the same address space or on a machine hundreds of miles
away.  If this principle is applied when designing your primitives,
you will be able to switch processes around very easily (note that
"processes" here can mean Unix processes or light weight processes
(LWP)).

This implies that your primitives must support light weight processes,
otherwise you make the addition of an extra process an expensive
buisness and thereby encourage the application programmer not to use
them on cost grounds (this kind of thing is of course the source of
most computing budget overruns).

So, what you wind up needing is a set of message primitives and a LWP
kernel which is hooked into the IPC mechanism in such a way that
messages can be sent between concurrent processes either within one
address space or over the IPC.

Imperial College, London have implemented their "CONIC" language,
which does all this and does it very well.  I have borrowed many of
their concepts and implemented an LWP system which could be hooked
into the IPC (though I did not actually get around to that) in C++.  I
have held off doing this in Eiffel (although I would really like to do
so) because Meyer (unlike Stroustrup) feels that LWP support should be
part of the language, not the class library.  ISE have promissed that
Eiffel will have LWP support and Meyer is working on a paper about it.
When that comes out, I will be looking at it with great interest.
Here is the reason:

A few years ago Nelson and Birrel (note: I am doing this from memory:
sorry if I get anything wrong) proposed "Remote Procedure Calls".  The
idea was that IPC messages should be sent and received through the
same interface as normal function calls.  The major problem with this
concept is that remote calls can fail for reasons that have nothing to
do with the remote procedure.  Hence potentially remote calls
("potentially" because of the distribution transparency I described
earlier) need extra stuff to manage failures which is not part of the
normal function call.

Eiffel has its exception handling mechanism.  When a call fails (for
whatever reason) exception handlers are automatically triggered so
that appropriate action can be taken.  This frees the application
programmer from having to keep testing results for network failure.
Hence something very close to the original Nelson & Birrel concept can
be implemented.  Of course exception handlers still need to be
implemented to handle failures, but they can be moved up the call tree
to the place where the failure should reasonably be dealt with: the
programmer no longer has to write code for passing the failures up
from every single remote call.

I guess this is rather more than you wanted to know.  To summarise: I
suggest you wait for Eiffel 3.0.  If ISE have not done what you want
themselves, try a DIY variation of the C library code that implements
the feature call between concurrent objects.  I am going to be trying
this myself.

Please note that apart from using Eiffel, I have no connection with
ISE.  Apart from having talked to Bertrand Meyer about his plans for
concurrency, I have no inside information about Eiffel 3.0, and cannot
guarantee that what I suggest will work.

Sorry but the code for the C++ LWP library is owned by GEC-Marconi.  I
cannot let it out of the company.


Paul.
-- 
Paul Johnson                               UUCP: <world>!mcvax!ukc!gec-mrc!paj
--------------------------------!-------------------------|-------------------
GEC-Marconi Research is not 	| Telex: 995016 GECRES G  | Tel: +44 245 73331
responsible for my opinions.	| Inet: paj@uk.co.gec-mrc | Fax: +44 245 75244