caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* question of a layman
@ 1995-10-24 17:47 Robbert VanRenesse
  0 siblings, 0 replies; only message in thread
From: Robbert VanRenesse @ 1995-10-24 17:47 UTC (permalink / raw)
  To: caml-list


I have built a complex system in C, and now I'm thinking of options to
re-implement it in CAML.

In short:  we at Cornell University are building a communication system
called Horus.  Horus is a framework that allows the composition of
microprotocols into more complex protocols.  Examples of microprotocols
are sliding window protocols, fragmentation/reassembly protocols, ordering
protocols, and membership protocols.  Each micro-protocol is fairly simple,
and has the *same* top and bottom-level interfaces.  In particular, these
interfaces contain send and deliver.  For example, the sliding window
micro-protocol's send operation adds a sequence number to a message and
invokes the send operation of the micro-protocol below it.

Basically, we can build complex protocols by stacking instances of
micro-protocols on top of each other.  Also, we want to be able to run
multiple stacks at a time (if only to maintain connections to different
peers).  Each instance of a micro-protocol maintains some state.

How would you implement something like this in CAML?  We did an initial
version, which follows the C version and uses mutable records to maintain
the protocol state.  However, even though it works, this does not appear
to me as the most natural way of doing it.

I guess the most natural way of implementing a micro-protocol in CAML is
as a stream to stream function.  A stream is then a stream of send and
deliver (and other) events.  You can then build a stack by composing these
functions.

However, two things are still unclear to me:

1) how do you run multiple of these functions at a time in the same
   address space?
2) how do you link it into an existing application written in C.  That is,
   when the C application invokes send(), how do I plug this event into
   the event stream of the function?  And, perhaps the same question, how
   do I make sure that the function maintains its state?

I have a multi-threading system, and I can probably run the CAML interpreter
in thread separate from the application that is written in C, which may be
part of a solution.

I guess the most natural solution would be to run each composition of
stream functions in its own thread, but I don't know how hard this is
to support, or even if this is desirable.  If necessary, I could run
each one in its own address space, but that would be expensive.

I would appreciate any answers/comments.

				Robbert




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-10-24 19:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-10-24 17:47 question of a layman Robbert VanRenesse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).