caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yaron Minsky <yminsky@janestreet.com>
To: Hendrik Boom <hendrik@topoi.pooq.com>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Async and lwt
Date: Thu, 30 Jun 2016 21:26:17 -0400	[thread overview]
Message-ID: <CACLX4jQzg=-+y2kXR6-QCsn8VUwrFAd++Nwdc_i8AWod75ut+A@mail.gmail.com> (raw)
In-Reply-To: <20160701004152.GA23017@topoi.pooq.com>

The conceptual differences are pretty thin; there are some error
handling differences, but they're not huge.

As for the shared heap question: Async greatly improves the
programmers ability to reason about concurrent code by providing clear
bounds on when interleaving can happen.  In particular, a given job
scheduled to run as part of Async can never be interrupted by another
async job. That means interleavings can effectively only happen where
you use a bind operator to string two closures together, and so one is
rarely exposed to race conditions. That means that Async program
typically don't need to think much about locking, and race conditions
stop being your primary source of bugs.

Using Async in the context of shared heap parallelism gives up these
guarantees, and puts you back in mutex/sempahore/condition-variable
hell.  My guess is that we'll end up taking advantage of the multicore
GC by running multiple Async schedulers, one per domain (e.g., OS
thread), and having carefully written primitives for sharing
data-structures and efficiently sending immutable messages between
these domains.  But I think just freely scheduling Async jobs across
multiple physical threads seems like a disaster from the point of view
of producing comprehensible, reliable code.

y

On Thu, Jun 30, 2016 at 8:41 PM, Hendrik Boom <hendrik@topoi.pooq.com> wrote:
> On Thu, Jun 30, 2016 at 08:13:58PM -0400, Yaron Minsky wrote:
>> I'm not at all sure that the decoupling is possible or wise for Async.
>> My intuition is that this is too complex of a problem with too much
>> need for careful optimization to be able to have a simple, shared
>> generic data structure for this.
>>
>> The solution that seems most plausible to me is to settle on one
>> implementation, and port the API of one library to run on top of the
>> other. There was indeed an experiment in this direction that was done
>> by Jeremie Dimino:
>>
>> https://github.com/janestreet/lwt-async
>>
>> That said, until we resolve the binary size issues with Core and
>> therefore Async, I doubt that this solution would be appealing to the
>> full community of lwt users.
>
> What are the conceptual differences between Async and lwt?  Does either
> of them manage to take advantage of a shared-heap multicore system?
>
> -- hendrik
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

  reply	other threads:[~2016-07-01  1:26 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 10:01 [Caml-list] how to encourage adoption of OCaml? Dean Thompson
2016-06-30 10:16 ` Kakadu
2016-06-30 10:41   ` Dean Thompson
2016-06-30 10:46   ` Anil Madhavapeddy
2016-06-30 10:17 ` Jeremy Yallop
2016-06-30 10:31   ` Dean Thompson
2016-06-30 12:12     ` Yaron Minsky
2016-06-30 13:13       ` Ivan Gotovchits
2016-07-01  0:13         ` Yaron Minsky
2016-07-01  0:41           ` [Caml-list] Async and lwt Hendrik Boom
2016-07-01  1:26             ` Yaron Minsky [this message]
2016-07-01 12:44           ` [Caml-list] how to encourage adoption of OCaml? Dean Thompson
2016-07-01 12:46             ` Yaron Minsky
2016-07-04 14:12           ` sp
2016-06-30 11:49 ` Gerd Stolpmann
2016-07-04 14:45 ` sp
2016-07-08 12:57   ` Dean Thompson
2016-07-08 13:45     ` Francois Berenger
2016-07-08 14:40     ` Gabriel Scherer
2016-07-08 15:16       ` Duane Johnson
2016-07-08 15:33         ` Roberto Di Cosmo
2016-07-08 16:25           ` Yotam Barnoy
2016-07-08 16:50             ` Roberto Di Cosmo
2016-07-08 16:54         ` Mohamed Iguernlala
2016-07-08 17:02           ` Yotam Barnoy
2016-07-08 17:09             ` Yotam Barnoy
2016-07-08 17:29               ` Kakadu
2016-07-08 17:41                 ` Dean Thompson
2016-07-08 17:49                   ` Yotam Barnoy
2016-07-08 17:28             ` Duane Johnson
2016-07-09 13:46             ` Ashish Agarwal
2016-07-09 13:51               ` Gabriel Scherer
2016-07-09 14:13                 ` Dean Thompson
2016-07-09 17:29                   ` Duane Johnson
2016-07-10 14:03                     ` Gabriel Scherer
2016-07-10 14:25                       ` Yotam Barnoy
2016-07-10 14:29                         ` Jesse Haber-Kucharsky
2016-07-10 14:34                           ` Gabriel Scherer
2016-07-10 14:47                             ` Yotam Barnoy
2016-07-10 16:45                               ` Glen Mével
2016-07-10 16:59                                 ` Yotam Barnoy
2016-07-10 18:40                                   ` Yotam Barnoy
2016-07-10  3:06                 ` Yotam Barnoy
2016-07-10  2:32               ` Yotam Barnoy
2016-07-10 19:17                 ` Ashish Agarwal
2016-07-08 19:16         ` [Caml-list] Getting the word out Hendrik Boom
2016-07-08 20:51           ` moosotc
2016-07-08 22:48             ` Hendrik Boom
2016-07-08 20:57           ` Steven Shaw
2016-07-08 21:13             ` Duane Johnson
2016-07-08 22:54               ` Yotam Barnoy
2016-07-08 23:11                 ` Duane Johnson
2016-07-09 13:13                   ` Ashish Agarwal
2016-07-08 22:02           ` SP
2016-07-08 21:56         ` [Caml-list] how to encourage adoption of OCaml? SP
2016-07-08 22:18           ` Fabrice Le Fessant
2016-07-08 22:39             ` Duane Johnson
2016-07-08 23:00               ` Yotam Barnoy
2016-07-09 13:03             ` Armaël Guéneau
2016-07-09 13:42               ` Dean Thompson
2016-07-08 21:46       ` SP
2016-07-08 22:05         ` Robert Muller
2016-07-08 23:11           ` Gerd Stolpmann
2016-07-09  1:37             ` Markus Mottl
2016-07-09 22:19               ` Yaron Minsky

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='CACLX4jQzg=-+y2kXR6-QCsn8VUwrFAd++Nwdc_i8AWod75ut+A@mail.gmail.com' \
    --to=yminsky@janestreet.com \
    --cc=caml-list@inria.fr \
    --cc=hendrik@topoi.pooq.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).