From: Markus Mottl <markus.mottl@gmail.com>
To: Mark Shinwell <mshinwell@janestreet.com>
Cc: "Yaron Minsky" <yminsky@janestreet.com>,
"Török Edwin" <edwin+ml-ocaml@etorok.net>,
"caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Threads and "transaction isolation" in OCaml
Date: Mon, 19 Aug 2013 10:18:44 -0400 [thread overview]
Message-ID: <CAP_800q_Jf0wumzJ-KSNi11kdvLjTgjQ_vL6X3-+kihV9P0hZQ@mail.gmail.com> (raw)
In-Reply-To: <CAM3Ki75k3V7bLffL5meJv40UixTd1dNwVMJxiYifhqvhkBX+jA@mail.gmail.com>
On Mon, Aug 19, 2013 at 2:10 AM, Mark Shinwell <mshinwell@janestreet.com> wrote:
> I have wondered in the past if we should introduce a syntactic
> construct to delimit areas of code that rely on the no-thread-switch
> property. I think it would probably be reasonable to actually
> check that the expression inside the construct was guaranteed under
> the current runtime not to cause a context switch (such expressions are
> likely to be, and should be, straightforward). At runtime, the
> construct would have no semantic effect. For the scenario described
> with bytecode, the construct could just cause a compiler error, at
> least at present.
This might just require adding two new primitives
(enter/leave_transaction) to the standard library. If e.g. the native
code compiler sees that there is no allocation in-between, these could
even become no-ops. Otherwise the runtime system might just need to
check one extra flag when deciding whether to do a context switch,
which would have negligible cost and apparently low complexity. Of
course, using these primitives requires great care so maybe they
should be prefixed with "unsafe_".
Regards,
Markus
--
Markus Mottl http://www.ocaml.info markus.mottl@gmail.com
next prev parent reply other threads:[~2013-08-19 14:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-15 21:57 Markus Mottl
2013-08-16 1:28 ` John F Carr
2013-08-16 2:55 ` Markus Mottl
2013-08-16 8:46 ` Török Edwin
2013-08-16 16:07 ` Markus Mottl
2013-08-17 0:06 ` Yaron Minsky
2013-08-19 6:10 ` Mark Shinwell
2013-08-19 14:18 ` Markus Mottl [this message]
2013-08-19 7:33 ` 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=CAP_800q_Jf0wumzJ-KSNi11kdvLjTgjQ_vL6X3-+kihV9P0hZQ@mail.gmail.com \
--to=markus.mottl@gmail.com \
--cc=caml-list@inria.fr \
--cc=edwin+ml-ocaml@etorok.net \
--cc=mshinwell@janestreet.com \
--cc=yminsky@janestreet.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