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
Thread library for ocamlopt?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1997-08-29 (17:34)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Thread library for ocamlopt?
> Is there a plan to include the Thread module in the native compiler
> framework?  Or is there a work done with native concurrent ocaml?

The existing thread library works by context-switching at the level of
the bytecode interpreter.  This makes it highly portable to most Unix
systems, but of course the technique does not extend to the
native-code compiler.

To support native code, the thread library must be built on top of
"real" OS threads, e.g. Posix 1003.1c threads or Win32 threads.
We have such an implementation of Caml threads for Win32 (bytecode
only).  Some work is in progress to extend it to Posix threads and to
the native-code compiler.  The two main drawbacks are:

* Available only on Unix systems that provide fully conformant Posix
1003.1c threads, e.g. Solaris 2.5, Digital Unix 4.0, or Linux with
LinuxThreads, but not HPUX, SunOS, nor earlier versions of Digital
Unix, for instance.

* Preemption of long-running threads can only occur at allocation
points (for reasons relevant to both the garbage collector and the
handling of signals in ocamlopt), which can result in a relatively
rough scheduling for compute-bound threads.

- Xavier Leroy