From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 948DCBC69 for ; Sun, 22 Apr 2007 10:44:28 +0200 (CEST) Received: from furbychan.cocan.org (furbychan.cocan.org [80.68.91.176]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3M8iRYO002816 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sun, 22 Apr 2007 10:44:28 +0200 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1HfXgC-0005Xp-00; Sun, 22 Apr 2007 09:44:20 +0100 Date: Sun, 22 Apr 2007 09:44:20 +0100 To: Jason Ganetsky Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Multiprocessor support in OCaml Message-ID: <20070422084420.GA21253@furbychan.cocan.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: Richard Jones X-Miltered: at concorde with ID 462B206B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 sml:01 beginner's:01 beginner's:01 threads:01 acb:98 15.:98 beginners:01 garbage:01 wrote:01 caml-list:01 caml-list:01 unsafe:01 modules:02 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