Browse thread
threads library in Objective Caml
- Pawel Wojciechowski
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 1997-04-14 (13:58) |
From: | Pawel Wojciechowski <Pawel.Wojciechowski@c...> |
Subject: | threads library in Objective Caml |
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