Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Real Time Ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-14 (17:07)
From: Basile STARYNKEVITCH <basile@s...>
Subject: Re: [Caml-list] Real Time Ocaml
On Wed, Apr 14, 2004 at 09:12:27AM -0700, Erol Akarsu wrote:

> I am evaluating Ocaml for the implementation language
> to build Semantic Web-based services.
> I would like to run the required Ocaml application on
> a Real Time Operating System. 

You did not define what you call a real-time OS. Given your
objectives, I guess it does not mean hard real time system.

> I think Ocaml generates an intermediate C code and compile it into
> binary code or maybe directly into binary one.

No. Ocaml comes in two flavors:

   a compiler "ocamlc" generating bytecode (not JVM bytecode, but Ocaml
   bytecode) for a specific VM designed for Ocaml. Thr VM is a fast
   bytecode interpreter coded in C (I am coding is an experimental,
   unsopported, JIT version of it - see my home page at INRIA on - this JIT translator uses GNU
   lightning and is still a little buggy - beta stage).

   a compiler "ocamlopt" generating machine code (via assembler, like most C or
   C++ compilers do) for several architectures and systems.

> We have so many real time OSs that support C language.
> In this case, I don't know Ocaml can compile on Real
> time OS. This issue is very critical for the project.

> Have we tried to run Ocaml application on any real
> time os?

Several Ocaml applications are very interactive (e.g. advi... and some
servers). But since you did not define what you mean by real time, it
is hard to guess what exactly are your needs.

Some points (but other collegues could give more details)

  1. The OCaml runtime, in particular its garbage collector, is not
  real time (in the sense, for example, of being able to react thru
  Ocaml code to external events in a stricty bounded & controlled
  manner). However, it can be suited to react in small bounded time
  e.g. less that 100 milliseconds [and perhaps even much less, I
  don't know exactly] on today's >1GHz x86 processors in most of the
  cases. However, on some occasion, a full compacting garbage
  collection is triggered, which may need some significant delay
  (depending upon your memory consumption).

  2. The garbage collector can be tuned for good interactive
  performance. See the Gc module for details, and look into the
  mailing list archives for more.

  3. Porting the core of Ocaml runtime to non-Posix realtime systems
  should be doable (I believe some people did it, ...) but requires a
  significant amount of work.

In a few words, you did not define what you mean by real-time system;
Ocaml is not really real-time, but suitable for interactive programs
(with some tuning of its GC). I think that Ocaml could be used for
servers, including Web servers.

Please note that even standard C is not real-time: there is no
real-time guarantee (or even specification) of the behavior of
essential C library functions like malloc or fprintf.

email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: