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] implementation of user-mode threads
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-08 (23:42)
From: Julien Verlaguet <julien_verlaguet@h...>
Subject: [Caml-list] implementation of user-mode threads
We are writting (a friend and me), the ocaml implementation of Fair Threads 
We wrote a first implementation on top of the ocaml threads.
But to make a more efficient version we wrote a second version on top of the 
Pth threads (
To make the whole work properly we first had to rewrite the ocaml threads 
using this library.
It seems to work but a few questions are still pending, here they are :

  - Each time a thread switches his contex, his stack is registered as a 
global root, and the new running thread is unregistered, to avoid the GC to 
do the work twice on the stack. Is it slow ? I saw in the 
otherlibs/systhreads/posix.c a "hook", can I use it from "outside" ? because 
I would like the library to be usable without recompiling ocaml.

  - For the bytecode version, there is a segfault which seems to be a big 
issue. The pth threads to work properly need to be initialised (as first 
instruction in the main), and of course the first thing to be initialized on 
the bytecode version is not the pth mode. We tryed to modify startup_code 
but didn't work. We had a look at the library, but it would be better if the library 
could be usable directly in caml (without a main in C). Anyway, are 
vmthreads slower ? Because if they are not we could keep our implementation 
on top of caml threads for the bytecode mode ...

  - Apparently the pth threads can not be used with windows. Does any 
binding from a "user-mode thread library for windows" to caml exist ?

Finally, the threads seem to react fine with C code without any mutex (BUT 
THEY ARE COOPERATIVE!! ... that's why it works). If u are not scared of 
cooperative threads and u need to bind some C code with caml code u can 
contact us (we are trying to finish as soon as possible).

MSN 8 with e-mail virus protection service: 2 months FREE*

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