caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Malcolm Matalka <mmatalka@gmail.com>
Cc: Jeremie Dimino <jdimino@janestreet.com>,
	Yaron Minsky <yminsky@janestreet.com>,
	Yotam Barnoy <yotambarnoy@gmail.com>,
	Jesper Louis Andersen <jesper.louis.andersen@gmail.com>,
	Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Question about Lwt/Async
Date: Wed, 09 Mar 2016 11:23:48 +0100	[thread overview]
Message-ID: <1457519028.13223.20.camel@e130.lan.sumadev.de> (raw)
In-Reply-To: <86vb4w85o2.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3510 bytes --]

Am Mittwoch, den 09.03.2016, 07:35 +0000 schrieb Malcolm Matalka:
> Jeremie Dimino <jdimino@janestreet.com> writes:
> 
> > On Tue, Mar 8, 2016 at 12:47 PM, Yaron Minsky <yminsky@janestreet.com>
> > wrote:
> >
> >> Jeremie, other than having some different back-ends available (e.g., glib
> >> main loop), how different are the approaches to backend management between
> >> Async and Lwt?
> >>
> >
> > ​The backend interfaces are slightly different​, but we just need a bit of
> > glue in the middle. Essentially the difference is that with Lwt you provide
> > one callback per fd and watch (read or write), while with Async you have a
> > global callback.
> >
> > ​Right now what we need to change in Async to make this work is:
> >
> > - allow to provide a backend ​programmatically; right now you can only
> > choose between the predefined epoll and select ones
> > - make the scheduler ignore fds returned by the backend that are not
> > handled by async
> 
> For what it's worth, which isn't much right now, I've been slowly
> developing an interface point for event loops and user facing code.  The
> rough idea is to present "asynchronous system calls" like an OS would,
> so user facing code has an interface to program against and the
> underlying event loop can change as someone wants, libev, libuv, direct
> epoll or kqueue, etc.  So Async and Lwt libraries could be implemented
> in terms of this interface and share the same event loop, to cooperate
> nicely.  So far I haven't implemented anything using the interface
> except for a barely functional test to demonstrate that it even works,
> so it's quite raw.  And it's clearly deficient on a few things, but I
> think the idea is sound and would alleviate some of the pain of deciding
> to use Lwt or Async and if it works on JS or Windows or My Favorite OS
> (just flip out the underlying scheduler implementation).
> 
> The work in progress around the interface can be found below, any
> constructive feedback would be appreciated.
> 
> https://bitbucket.org/acslab/abb_scheduler_inf/src
> 

Very academic. The reality is different. Most of these operations are
only provided as synchronous calls anyway in all OS I know (and you can
only provide a non-blocking version by using helper threads). The only
operations you can do something about are those reading/writing a file
descriptor, but even here there is a strong OS dependency, e.g. on
Windows async operations are very restricted, limiting implementation
options drastically. The truth is that you cannot abstract the OS away.

And what if I need linkat and not link? And what about calling my
favorite C library that uses blocking I/O? E.g. I'm often preferring a
variant of Unix.read/write using bigarrays as buffer.

I'd prefer a reduced approach for interoperability: Focus on event loops
and ways to read/write, and accept that everything else must be dealt
with using helper threads.

Sorry for not being constructive. I don't like the approach (and I also
don't like Lwt and Async, and by the way these are not the only kids on
the block).

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
My OCaml site:          http://www.camlcity.org
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-03-09 10:24 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-07  1:38 Yotam Barnoy
2016-03-07  7:16 ` Malcolm Matalka
2016-03-07  9:08   ` Simon Cruanes
2016-03-07 14:06     ` Yotam Barnoy
2016-03-07 14:25       ` Ashish Agarwal
2016-03-07 14:55         ` rudi.grinberg
2016-03-07 14:59           ` Ivan Gotovchits
2016-03-07 15:05             ` Ivan Gotovchits
2016-03-08  6:55         ` Milan Stanojević
2016-03-08 10:54           ` Jeremie Dimino
2016-03-07 15:16 ` Jesper Louis Andersen
2016-03-07 17:03   ` Yaron Minsky
2016-03-07 18:16     ` Malcolm Matalka
2016-03-07 18:41       ` Yaron Minsky
2016-03-07 20:06         ` Malcolm Matalka
2016-03-07 21:54           ` Yotam Barnoy
2016-03-08  6:56             ` Malcolm Matalka
2016-03-08  7:46               ` Adrien Nader
2016-03-08 11:04               ` Jeremie Dimino
2016-03-08 12:47                 ` Yaron Minsky
2016-03-08 13:03                   ` Jeremie Dimino
2016-03-09  7:35                     ` Malcolm Matalka
2016-03-09 10:23                       ` Gerd Stolpmann [this message]
2016-03-09 14:37                         ` Malcolm Matalka
2016-03-09 17:27                           ` Gerd Stolpmann
2016-03-08  9:41     ` Francois Berenger
2016-03-11 13:21     ` François Bobot
2016-03-11 15:22       ` Yaron Minsky
2016-03-11 16:15         ` François Bobot
2016-03-11 17:49           ` Yaron Minsky
2016-03-08  5:59 ` Milan Stanojević

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=1457519028.13223.20.camel@e130.lan.sumadev.de \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@inria.fr \
    --cc=jdimino@janestreet.com \
    --cc=jesper.louis.andersen@gmail.com \
    --cc=mmatalka@gmail.com \
    --cc=yminsky@janestreet.com \
    --cc=yotambarnoy@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).