From: ygrek <ygrekheretix@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] threads
Date: Thu, 10 Sep 2009 21:17:34 +0300 [thread overview]
Message-ID: <20090910211734.e959be39.ygrekheretix@gmail.com> (raw)
In-Reply-To: <4d1b2df20909081620r55accbc1q837dd78317a7923f@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
On Wed, 9 Sep 2009 01:20:06 +0200
Philippe Wang <philippe.wang.lists@gmail.com> wrote:
> > let x = Array.make 100 []
> > let update i n = x.(i) <- n :: x.(i)
> > let read i = x.(i)
>
> I don't think you can obtain funny results when you don't put a mutex
> on these two specific "update" and "read".
> What is sure is that "update" function is not atomic because you have
> a value allocation at the right of "<-" (with :: operator), and this
> may trigger garbage collection and/or make the scheduler change the
> running thread.
Yes, that's not a problem.
Thinking that over again it looks like the only issue remaining is the
possibility that compiler can be too smart and cache/reorder memory
operations, but ocamlopt is not of that kind, right?
--
ygrek
http://ygrek.org.ua
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2009-09-10 18:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-08 17:33 threads ygrek
2009-09-08 23:20 ` [Caml-list] threads Philippe Wang
2009-09-10 18:17 ` ygrek [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-06-10 17:56 Threads Jonathan Bryant
2005-06-11 7:46 ` [Caml-list] Threads Christophe Raffalli
2005-06-11 14:02 ` james woodyatt
2005-06-11 21:03 ` Christophe Raffalli
2002-03-20 2:59 [Caml-list] threads Francois Rouaix
2002-03-20 8:11 ` Remi VANICAT
2002-03-20 10:54 ` Sylvain LE GALL
2002-03-22 14:55 ` Xavier Leroy
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=20090910211734.e959be39.ygrekheretix@gmail.com \
--to=ygrekheretix@gmail.com \
--cc=caml-list@yquem.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