From: Richard Jones <rich@annexia.org>
To: Jonathan Roewen <jonathan.roewen@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Pre-emptive multitasking
Date: Sun, 12 Jun 2005 11:13:23 +0100 [thread overview]
Message-ID: <20050612101323.GA21947@furbychan.cocan.org> (raw)
In-Reply-To: <ad8cfe7e0506111351671ba8c5@mail.gmail.com>
On Sun, Jun 12, 2005 at 08:51:44AM +1200, Jonathan Roewen wrote:
> Does the OCaml runtime support true pre-emptive multitasking with the
> systhreads module? Am curious how this works with the GC without
> breaking anything.
The GC isn't thread-safe. This means that when OCaml code runs, it
must be protected by a global mutex. If you have two threads running
OCaml code, they will contend for this mutex, and run (around) 50% of
the time each. If you have two CPUs you won't gain any benefit. The
standard solution would be to run one OCaml thread and lots of C
threads, or else use fork(2) to create one separate process for each
processor and use shared memory, sockets, pipes, etc. for
communication.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
next prev parent reply other threads:[~2005-06-12 10:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-11 20:51 Jonathan Roewen
2005-06-12 10:13 ` Richard Jones [this message]
2005-06-12 22:02 ` Jonathan Roewen
2005-06-13 8:30 ` Benjamin Geer
2005-06-13 22:12 ` Jonathan Roewen
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=20050612101323.GA21947@furbychan.cocan.org \
--to=rich@annexia.org \
--cc=caml-list@yquem.inria.fr \
--cc=jonathan.roewen@gmail.com \
/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).