From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA30880; Mon, 2 Apr 2001 15:27:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA30935 for ; Mon, 2 Apr 2001 15:27:52 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f32DL5j28640; Mon, 2 Apr 2001 15:21:05 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA30940; Mon, 2 Apr 2001 15:21:06 +0200 (MET DST) Date: Mon, 2 Apr 2001 15:21:06 +0200 From: Xavier Leroy To: David Fox Cc: caml-list@inria.fr Subject: Re: [Caml-list] Threads in OCaml Message-ID: <20010402152106.C30450@pauillac.inria.fr> References: <001801c0b72d$7fd17a60$210148bf@dylan> <20010330165131.A2384@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from dsfox@cogsci.ucsd.edu on Fri, Mar 30, 2001 at 03:12:02PM -0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > [OCaml's "master lock"] > How good or bad an arrangement is this? I've been asked about the > threading facilities of ocaml, but I don't know enough to compare and > contrast, say, ocaml and Java. On a multiprocessor machine, the "master lock" scheme is really bad, since it prevents OCaml code from running on more than one processor at once. On a single-processor machine, it's OK, but not great. Since there is only one processor, it's not that bad to serialize execution of all OCaml code -- execution of all threads is eventually serialized on the processor. However, the extra locking performed at the level of the OCaml code can make thread scheduling a bit less smooth. This depends a lot on the fairness characteristics of the underlying system threads library. As compared with Java, threads in OCaml are a late addition to the library and implementation, while the Java language, libraries and implementations were designed from the very beginning with threads. So one can expect Java threading to be somehow more mature; it is certainly true for the libraries, not so true for the implementations (e.g. Sun's JDK implementation sucks, w.r.t. threads as well as w.r.t. everything else :-). On the other hand, a thread-aware runtime system and library such as Java's pays a significant execution penalty for single-threaded code. In a way, you're paying all the time for hypothetical speedups on less-and-less-common multiprocessor machines. I'll let you decide if this is a reasonable deal or not... - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr