Version française
Home     About     Download     Resources     Contact us    
Browse thread
Multiprocessor support in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Multiprocessor support in OCaml
On Sun, Apr 22, 2007 at 03:42:09AM -0400, Jason Ganetsky wrote:
> I'm new to this list, and new to OCaml (although, have some experience with
> SML).

There's a beginner's list:
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

> Anyway, I have recently written an OCaml thread pool implementation, on top
> of the Thread and Event modules. I did this for the purpose of exploiting an
> SMP system I have, and was a disappointed to read today that OCaml doesn't
> support multiprocessor systems.
> 
> I played around with it a little, and discovered that by liberally calling
> Thread.yield, I do cajole my threads into running on multiple processors. Is
> this behavior normal, or have I discovered a problem with the Thread module?
> I'm certainly happy that I can get it to use my SMP... but I will stop it at
> once if you tell me that this is unsafe.

The garbage collector doesn't support concurrency, so there's a big
global lock around all OCaml code.

http://caml.inria.fr/pub/ml-archives/caml-list/2002/11/64c14acb90cb14bedb2cacb73338fb15.en.html

Rich.

-- 
Richard Jones
Red Hat