caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: David Fox <dsfox@cogsci.ucsd.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Threads in OCaml
Date: Mon, 2 Apr 2001 15:21:06 +0200	[thread overview]
Message-ID: <20010402152106.C30450@pauillac.inria.fr> (raw)
In-Reply-To: <lu8zlm3l8d.fsf@hci.ucsd.edu>; from dsfox@cogsci.ucsd.edu on Fri, Mar 30, 2001 at 03:12:02PM -0800

> [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


      parent reply	other threads:[~2001-04-02 13:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-28  2:19 [Caml-list] Complex Numbers David McClain
2001-03-28  3:38 ` [Caml-list] OCaml, where art thou? Anjayan Puvananathan
2001-03-30 14:51   ` Xavier Leroy
2001-03-30 23:12     ` David Fox
2001-03-31  9:31       ` [Caml-list] Using HTML as a standard GUI for Ocaml Mattias Waldau
2001-04-01 12:52         ` Fergus Henderson
2001-04-01 20:11         ` Sven LUTHER
2001-04-01 20:35           ` Bruce Hoult
2001-04-02 10:09             ` Sven LUTHER
2001-04-02 15:53               ` CREGUT Pierre FTRD/DTL/LAN
2001-04-02 19:16         ` Gerd Stolpmann
2001-04-03 18:06           ` Mattias Waldau
2001-04-02 13:21       ` Xavier Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010402152106.C30450@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=dsfox@cogsci.ucsd.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).