From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id UAA03519 for caml-redistribution; Tue, 24 Oct 1995 20:29:40 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id TAA02676 for ; Tue, 24 Oct 1995 19:16:39 +0100 Received: from simon.cs.cornell.edu (SIMON.CS.CORNELL.EDU [128.84.154.10]) by concorde.inria.fr (8.6.10/8.6.9) with ESMTP id TAA14207 for ; Tue, 24 Oct 1995 19:16:29 +0100 Received: from cloyd.cs.cornell.edu (CLOYD.CS.CORNELL.EDU [128.84.227.15]) by simon.cs.cornell.edu (8.6.10/R1.4) with ESMTP id NAA29610 for ; Tue, 24 Oct 1995 13:48:03 -0400 Received: from snotra.cs.cornell.edu (SNOTRA.CS.CORNELL.EDU [128.84.218.5]) by cloyd.cs.cornell.edu (8.6.10/M1.8) with ESMTP id NAA11882 for ; Tue, 24 Oct 1995 13:48:02 -0400 From: Robbert VanRenesse Received: (rvr@localhost) by snotra.cs.cornell.edu (8.6.10/C1.3) id NAA00861 for caml-list@pauillac.inria.fr; Tue, 24 Oct 1995 13:47:59 -0400 Date: Tue, 24 Oct 1995 13:47:59 -0400 Message-Id: <199510241747.NAA00861@snotra.cs.cornell.edu> To: caml-list@pauillac.inria.fr Subject: question of a layman Sender: weis 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