Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Robbert VanRenesse <rvr@cs.cornell.edu>
To: caml-list@pauillac.inria.fr
Subject: question of a layman
Date: Tue, 24 Oct 1995 13:47:59 -0400	[thread overview]
Message-ID: <199510241747.NAA00861@snotra.cs.cornell.edu> (raw)


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




                 reply	other threads:[~1995-10-24 19:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199510241747.NAA00861@snotra.cs.cornell.edu \
    --to=rvr@cs.cornell.edu \
    --cc=caml-list@pauillac.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox