caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: Philippe Wang <philippe.wang.lists@gmail.com>
Cc: Goswin von Brederlow <goswin-v-b@web.de>, caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Question about ocaml threads and TLS (on linux)
Date: Thu, 25 Feb 2010 08:25:30 +0100	[thread overview]
Message-ID: <87635l4w0l.fsf@frosties.localdomain> (raw)
In-Reply-To: <4d1b2df21002241322l63b82636hf7465ec05de9d8ed@mail.gmail.com> (Philippe Wang's message of "Wed, 24 Feb 2010 22:22:06 +0100")

Philippe Wang <philippe.wang.lists@gmail.com> writes:

> Hi,
>
> I'm not sure I understand (though I've read the whole text), but maybe
> this will answer your question:
> On Linux, OCaml threads (with the native compiler "ocamlopt") are
> implemented with POSIX threads (in C), so when your OCaml thread runs
> the C stub, it's the same as if you were running the C stub in some C
> thread.

How about bytecode?

> When you are in a section declared as a blocking section, a collection
> can be triggered concurrently in another thread and so the heap must
> not be accessed neither for reading or writing, that's all.
>
> Using __thread recent feature should also work if you manage to
> compile everything correctly. Notably, we use it in some places in
> ocaml4multicore (a patch to ocaml's runtime library to allow parallel
> threads). However, I don't know how __thread is handled by the
> compiler... I mean : it there a pointer for buf in every thread or
> only in those that use it?

Only in those that use it. But that will be multiple threads. In those
that don't use it 4/8 bytes will be wasted.

> I hope my answer isn't useless!
>
> Cheers,

MfG
        Goswin


      reply	other threads:[~2010-02-25  7:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24 21:00 Goswin von Brederlow
2010-02-24 21:22 ` [Caml-list] " Philippe Wang
2010-02-25  7:25   ` Goswin von Brederlow [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=87635l4w0l.fsf@frosties.localdomain \
    --to=goswin-v-b@web.de \
    --cc=caml-list@inria.fr \
    --cc=philippe.wang.lists@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).