caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ian Zimmerman <itz@buug.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] vm threads
Date: 15 Oct 2005 01:52:45 -0400	[thread overview]
Message-ID: <87zmpb9viq.fsf@buug.org> (raw)
In-Reply-To: <20051015.142304.106269859.garrigue@math.nagoya-u.ac.jp>


Ian> Are Ocaml's VM threads preemptive?  That is, does the virtual
Ian> machine actually have a timer and give a slice to each thread?  Or
Ian> does a thread run until it's blocked?

Jacques> The timer signal is used, so they are preemptive.  This is
Jacques> however only true for threads running ocaml code.  There is no
Jacques> way to switch thread during C calls, so that all potentially
Jacques> blocking C calls should be manually converted to non-blocking
Jacques> ones (this is already done for the standard library and the
Jacques> Unix module.)  This can also create problems when somebody else
Jacques> needs the timer signal (for instance the Graphics module.)

The reason I asked was: when writing a library that uses C extension
code and a global data structure in the C code, can I just use system
thread primitives for synchronization (that would be pthreads since
I am only thinking about Unix type systems at least ATM) and not worry
about VM threads?

>From your post the answer seems to be yes.

-- 
"It's not true or not."  A reality show producer (real quote)


  reply	other threads:[~2005-10-15  5:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-15  4:52 Ian Zimmerman
2005-10-15  5:23 ` [Caml-list] " Jacques Garrigue
2005-10-15  5:52   ` Ian Zimmerman [this message]
2005-10-15  8:46     ` Jacques Garrigue

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=87zmpb9viq.fsf@buug.org \
    --to=itz@buug.org \
    --cc=caml-list@inria.fr \
    /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).