caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Re-entrant OCaml
@ 2016-12-29 17:46 Christoph Höger
  2016-12-29 18:26 ` Gabriel Scherer
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Höger @ 2016-12-29 17:46 UTC (permalink / raw)
  To: caml users


[-- Attachment #1.1: Type: text/plain, Size: 1336 bytes --]

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: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Re-entrant OCaml
  2016-12-29 17:46 [Caml-list] Re-entrant OCaml Christoph Höger
@ 2016-12-29 18:26 ` Gabriel Scherer
  0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Scherer @ 2016-12-29 18:26 UTC (permalink / raw)
  To: Christoph Höger; +Cc: caml users

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-29 18:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-29 17:46 [Caml-list] Re-entrant OCaml Christoph Höger
2016-12-29 18:26 ` Gabriel Scherer

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).