Re: Thread library for ocamlopt?

From: Xavier Leroy (
Date: Thu Aug 28 1997 - 13:30:56 MET DST

From: Xavier Leroy <>
Message-Id: <>
Subject: Re: Thread library for ocamlopt?
In-Reply-To: <> from Ken Wakita at "Aug 27, 97 06:07:09 pm"
To: (Ken Wakita)
Date: Thu, 28 Aug 1997 13:30:56 +0200 (MET DST)

> 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

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:12 MET