From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: "Christoph Höger" <christoph.hoeger@tu-berlin.de>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Re-entrant OCaml
Date: Thu, 29 Dec 2016 13:26:57 -0500 [thread overview]
Message-ID: <CAPFanBGTXH5XyQnK8cqte+Wq1ssOoLYqs0syMcANAWqHV5Oa_A@mail.gmail.com> (raw)
In-Reply-To: <a004616d-77ea-e690-ec6d-aa85f671cf64@tu-berlin.de>
[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]
My understanding is that the OCaml runtime is thread-safe (and when you use
native-threads you do get an OCaml process with several hardware threads),
but that it uses a big runtime lock that guarantees that only one thread at
a time can run OCaml code (the others are free to do whatever). You should
be able to safely use existing OCaml in a multi-threaded application, but
depending on how it is used it may result in a concurrency bottleneck.
(I'll let more informed others comment on the state of re-entrant runtimes.)
On Thu, Dec 29, 2016 at 12:46 PM, Christoph Höger <
christoph.hoeger@tu-berlin.de> wrote:
> Dear all,
>
> I am currently investigating a proprietary application server with an
> embedded functional language. The current implementation of the language
> misses several features and one particular interesting path for further
> development would be to compile it to OCaml.
>
> There is, however, the caveat of embedding the generated code in the
> application server. Right now, (compiled) programs are called directly
> from the core (effectively just C-functions) and call a certain API on
> the core (again, C-functions). This is possible in OCaml, too, but the
> default runtime is not thread-safe. If multiple such calls are made
> concurrently, I expect immediate havoc.
>
> Is there any project that provides a re-entrant runtime? In particular,
> I would be interested in a version of libasmrun (and the corresponding
> compiler) that does not rely on static variables. Instead, the required
> data could be passed as an argument to each function.
>
> Is there any such backend currently under development? How are the
> chances of mainlining?
>
> regards,
>
> Christoph
>
> --
> Christoph Höger
>
> Technische Universität Berlin
> Fakultät IV - Elektrotechnik und Informatik
> Übersetzerbau und Programmiersprachen
>
> Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin
>
> Tel.: +49 (30) 314-24890
> E-Mail: christoph.hoeger@tu-berlin.de
>
>
[-- Attachment #2: Type: text/html, Size: 2621 bytes --]
prev parent reply other threads:[~2016-12-29 18:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-29 17:46 Christoph Höger
2016-12-29 18:26 ` Gabriel Scherer [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=CAPFanBGTXH5XyQnK8cqte+Wq1ssOoLYqs0syMcANAWqHV5Oa_A@mail.gmail.com \
--to=gabriel.scherer@gmail.com \
--cc=caml-list@inria.fr \
--cc=christoph.hoeger@tu-berlin.de \
/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).