caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: shiv@ece.ucsb.edu
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] native threads not parallel?
Date: Fri, 21 Feb 2003 09:15:24 +0900	[thread overview]
Message-ID: <20030221091524C.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <847A10BA-4528-11D7-8C93-000393942C76@ece.ucsb.edu>

From: Shivkumar Chandrasekaran <shiv@ece.ucsb.edu>

> not. But I seem to have the same problem as discussed by Markus Mottl 
> (see attachment below) on Mac OS X 10.2.4 on a dual processor G4 
> machine. An earlier message in that thread mentioned that there was no 
> such problem on dual-processor Linux machines.

Let's answer again, since this is a frequent question: ocaml threads
do not not support parrallelism. Only one ocaml thread will run at a
time, independently of the number of processors, and this on any
architecture/OS.

> > From :Markus Mottl < mottl@miss.wu-wien.ac.at >
> > The only thing I can imagine is that OCaml somehow changes
> > scheduling so that the threads cannot run in parallel anymore, even if
> > "enter_blocking_section" is used. Is this possible? Or am I just making
> > some stupid mistake?

enter_blocking_section only happens in C code, and is followed by a
leave_blocking_section before returning to caml code. Since the
leave_blocking_section reacquires the lock, no more than one ocaml
thread can run simultaneously.
Easy way to crash the runtime: call a caml callback immediately after
an enter_blocking_section.  The two caml threads will start to
allocate simultaneously on the same heap, without any locking...

Jacques Garrigue
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2003-02-21  0:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-20 23:10 Shivkumar Chandrasekaran
2003-02-21  0:15 ` Jacques Garrigue [this message]
2003-02-21  4:24   ` shivkumar chandrasekaran
2003-02-21 10:43     ` Markus Mottl
2003-02-21 15:11     ` Jacques Garrigue
2003-02-21 17:57       ` Markus Mottl
2003-02-24 17:39       ` Shivkumar Chandrasekaran
2003-02-21  0:32 ` Chris Uzdavinis
2003-02-21  1:56   ` james woodyatt
2003-02-21  4:43   ` shivkumar chandrasekaran
  -- strict thread matches above, loose matches on Subject: below --
2001-06-15 16:49 Markus Mottl
2001-06-15 17:10 ` Xavier Leroy
2001-06-15 18:42   ` Markus Mottl
2001-06-15 21:33     ` Markus Mottl
2001-06-21 13:43       ` Markus Mottl

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=20030221091524C.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=shiv@ece.ucsb.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).