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] Thread in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-16 (10:26)
From: Christophe Raffalli <Christophe.Raffalli@u...>
Subject: [Caml-list] Thread in OCaml

My recent problems with threads suggest the following questions

1) why the name enter(resp leaving)_blocking_section to release(resp 
aquire) a mutex ? you aquire a mutex when you want to block other 
threads. The name seems inversed to me and this did not help.

2) is there a way to have two files wrap_glut.c one with 
enter/leaing_blocking_section the other without (or MACROS), the right 
file being used depending if the -thread or -vmthread option is given

3) I know a little (not much) about the runtime system of OCaml and I 
think (probably wrongly), that it would be enough to aquire a mutex when 
allocating heap object (for this you need a list of grey-val for each 
thread but it should not be difficult). What am I missing about the 
runtime ?

If you think a typical Caml program spend 20% of time during 
allocation(which include GC) then 5 threads could run concurrently on 5 
CPUs with some speedup (up to 5 times in the best case).

Remark: for me it is to the programmer to add mutex if a mutable is 
being written/read by more that one thread.

Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature