PROGRAMMING LANGUAGE TECHNOLOGIES
ERCIM News No.36 - January 1999

The JoCaml System: a Language for Programming on the Internet

by Sylvain Conchon, Fabrice Le Fessant and Luc Maranget


The JoCaml system is an experimental extension of the Objective-Caml language with the distributed join-calculus programming model. This model includes high-level communication and synchronising channels, mobile agents, failure detection and automatic memory management. JoCaml enables programmers to rapidly develop distributed large-scale applications, obtaining both the Objective-Caml ease of programming and extended libraries, and the join-calculus distributed and concurrent features. It can already be viewed as the next-generation Internet programming language.
Distributed programming languages can be divided in two opposite kinds: concurrent calculi (CSP, CCS, pi-calculus, etc) and practical languages (JAVA RMI, DCOM, CORBA, Actors, etc ). Concurrent calculi try to catch the formal basics behind distributed parallel programming, but are hardly implemented in really distributed platforms. Practical languages are heavily used, but lack formal specifications.


The PARA project at INRIA adopts both views. We thus designed a formal process calculus: the join-calculus and built practical implementations of programming languages based upon the join-calculus. We also made the significant effort of releasing tutorials and manuals. Two implementations are currently available: the distributed join-calculus and the JoCaml system. In this note, we focus on the second, more efficient, and more promising implementation. Work on the first implementation is now frozen and it thus may serve as a stable platform for developing small distributed applications.

After a first development effort of six months, JoCaml has been made available on the World-Wide Web in May 1998 at a beta stage. New beta releases have been distributed more recently with enhanced distributed garbage collection, and a final release will be made in a few months when failure detection is terminated.

JoCaml’s programming model contains useful communication abstractions, such as high-level point-to-point channels, mobile agents and remote method invocations. Spaces and agents are uniformly organized in hierarchical trees, with failure detection and possible migration of whole branches. This distributed model is embedded in the Objective-Caml language, with its full type inference and complete static type-checking with global lexical scope. All Objective-Caml programs and libraries can be compiled to be used in Jocaml programs.

Client ---------------------------

let def view ps | init! () =
let get_ps_viewer = Ns.lookup
"ps_viewer" vartype in
get_ps_viewer (top_location,ack);
view(ps)
or view(ps) | ack!(viewf) =
{viewf(ps);reply} | ack(viewf);;

{| init () };;

view "paper1.ps";
view "paper2.ps";;

Server --------------------------

let def get_ps_viewer (site,ack) =
let loc ps_viewer
[PostscriptViewer] do
{ go(site);
ack(PostscriptViewer.view) }
in reply;;

Ns.register "ps_viewer" ps_viewer
vartype ;;
Server --------------------------

Definition of the player class
with two methods:
goto: location -> unit
play_with : player -> unit

...

let def naval_war!(l,nom)
| wait_first!() =
{ wait_second(l,nom) }
or
naval_war!(loc1,nom1)
| wait_second!(loc2,nom2)=
let p1 = new player nom1
and p2 = new player nom2 in
{ p1#goto(loc1);
p1#play_with(p2);}
|
p2#goto(loc2);
|
wait_first () ;;

{| wait_first () };;

Ns.register "naval_war" naval_war
vartype;;

Client ---------------------------

let war = Ns.lookup "naval_war"
vartype in
{|war(top_location,''my name'')}
Figure 1: A postscript viewer service: The server code registers in the name-server a high-level RPC for a postscript file viewer service (whose code is in the PostscriptViewer Objective-Caml module). The client calls the RPC when a postscript file must be viewed. The first time (init state), the server is queried, and a mobile agent carrying the postscript viewer code migrates to the client. Other invocations are immediately sent to the already received mobile agent. Figure 2: A naval war server: The server contains the player class and a definition for high-level channel. The definition waits for the first player, then for the second player, then creates two objects that migrate to the respective player locations. At the end, the server has gone back to its initial state, and the players are autonomous.

The current JoCaml system contains the Objective-Caml distribution, version 1.07, with a modified compiler, a modified runtime system, the ‘join’ extra library and several examples of applications. Code migration is only supported for bytecode modules (modules are Objective-Caml code entities ), but both bytecode modules (for migration) and native-code modules (for efficiency) can be mixed in a single executable. The JoCaml runtime also provides automatic marshaling/ unmarshaling of all data types sent on high-level channels, transparent remote-pointer creation for channels, mobile agents and objects, complete distributed garbage collection using efficient algorithms, dynamic type-checking at the name server, and partial detection of space crashes.

Future work will mainly aim at improving failure detection and security in both theoretical and practical aspects. The first examples have also shown the need for improvments in the design of language constructs.

More information on Website: http://join.inria.fr/

Please contact:

Sylvain Conchon, Fabrice Le Fessant and Luc Maranget - INRIA
Tel: +33 1 3963 5801
E-mail: {sylvain.conchon, fabrice.le_fessant, luc.maranget}@inria.fr


return to the ERCIM News 36 contents page