threads library in Objective Caml

From: Pawel Wojciechowski (Pawel.Wojciechowski@cl.cam.ac.uk)
Date: Mon Apr 14 1997 - 11:35:10 MET DST


To: caml-list@inria.fr
Subject: threads library in Objective Caml
Date: Mon, 14 Apr 1997 10:35:10 +0100
From: Pawel Wojciechowski <Pawel.Wojciechowski@cl.cam.ac.uk>
Message-Id: <E0wGiAL-0003qE-00@heaton.cl.cam.ac.uk>

The potential advantage of threads is that on a multiprocessor shared memory
machine, each thread can run on a different processor. However, in the (O)Caml
documentation is written as follows: "The `threads' library is implemented
by time-sharing on a single processor. It will not take advantage of multi-
-processor machines. Using this library will therefore never make programs
run faster".

When writing concurrent porgrams, it is essential to handle concurrency
properly, and that means assigning threads dynamically. It is vital that
the threads are recognised at kernel level for independent allocation of
processor resource (otherwise it's "block one, block all", which is
intolerable).

Assuming that the threads library of the (O)Caml is implemented by using
the POSIX Unix thread library, in the light of the previous paragraph, it
seems to me that using threads in programs written purely in Caml is less
powerful (in terms of the program behaviour on multi-processor architecures)
that using threads in a program written in C. Could you briefly explain
this ?

On the other hand, on a single processor architecture, programs written
in Caml or C should take advantage of using threads library in exactly the
same way. Am I right?

Pawel



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