From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p9RIYGWP021380 for ; Thu, 27 Oct 2011 20:34:16 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjkBAFOjqU7U4xEIkWdsb2JhbABDhHekaSIBAQEBCQsLBxQDIoFyAQEFI1YQCxoCJgICVwYTCYd7BqMDkgCBMIY6gRQEjFCMaow0 X-IronPort-AV: E=Sophos;i="4.69,414,1315173600"; d="scan'208";a="126536957" Received: from moutng.kundenserver.de ([212.227.17.8]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 Oct 2011 20:34:11 +0200 Received: from office1.lan.sumadev.de (dslb-188-097-015-028.pools.arcor-ip.net [188.97.15.28]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0LcP1q-1QcyU00qzG-00k8FU; Thu, 27 Oct 2011 20:34:10 +0200 Received: from [192.168.0.29] (dslb-084-058-049-018.pools.arcor-ip.net [84.58.49.18]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 288A7C00C7; Thu, 27 Oct 2011 20:34:09 +0200 (CEST) From: Gerd Stolpmann To: Milan =?UTF-8?Q?Stanojevi=C4=87?= Cc: yminsky@gmail.com, caml-list@inria.fr In-Reply-To: References: <1319614400.18639.148.camel@thinkpad> <1319632284.18639.181.camel@thinkpad> Content-Type: text/plain; charset="UTF-8" Date: Thu, 27 Oct 2011 20:34:07 +0200 Message-ID: <1319740447.18639.220.camel@thinkpad> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 X-Provags-ID: V02:K0:mciQB4N3j0A5u0Zfqmo2ZlkSfXU1LOfmF6VtBnrzTF9 KkW4npuKBz9zrqqq7JT2GqZqaYZR1IxFg2SekOS0lgXNYGopUw cObLvDnCaGYY8KsMJLk8OJkHSPpJIEMKTzSzA935Q0AXhQBmx6 7CrjxIl5bc8o6Cw5aPZ19w8AtHFkrchM5Wp31OhsR81gLa0u8G WwA12rYTqLNcMX5t+fPevYC/psZOIm+Ilp2SDDU0t7VSsOSiQY rDTPbWpa253IzdW8Yy/rL6pNU4aIsr+vQVaAFvY1GggVa2HMiE 28Uxng65dcF3oJqvg8PBDrQIQGy0JrEILk5qeWL8q6UDg/owB3 2137kce0FAs+VMembakQMwnEDY0Qb8fudCJ7yAkxr Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p9RIYGWP021380 Subject: Re: [Caml-list] [ANN] Async, a monadic concurrency library Am Donnerstag, den 27.10.2011, 13:36 -0400 schrieb Milan Stanojević: > >> But I think we had good reasons for creating Async. As I said in my > >> blog post, the differences in error-handling and interleaving policy > >> were enough that we really felt we needed a different library. > > > > In deed this is interesting. Equeue also follows Lwt's idea not to > > interleave when possible, simply for performance reasons. You can, > > Did you mean to say "Lwt interleaves when possible"? > > For example > > let foo () = > let r = x >>= bar in > .... > r > > in Async [bar] will run only after [foo] has completed (therefore > there is no interleaving between [foo] and [bar]), while in Lwt [bar] > can run in the middle of [foo] so there is an interleaving You probably mean the case where x has already computed a result. When developing Uq_engines, I was a bit unsure how to treat this case. In the initial version, I just disallowed this case: There was simply no way to run into it. If you wanted to create a thread that just yields a constant value, the only way was the function eps_e, which "computes" the constant in one step (i.e. it is not immediately there, but only after rescheduling). Later I allowed this case, and also added const_e, which creates a thread with an immediate result. Nevertheless, almost all code I produced uses eps_e, not const_e, because the possible interactions with state changes are easier to overlook. However, there is also const_e when speed really matters. Besides this problem, I'm unsure where the other conceptual differences are between the threading implementation. For example, Equeue has actually two schedulers: one very simple one, which is only used when no I/O and no delays need to be considered (and which is local to Uq_engines), and a heavy one when these phenomenons can occur. The simple scheduler is really unfair - the next thread at hand is executed, often leading to a cache-friendly execution flow with high locality. But it's fast. The other scheduler is absolutely fair: all resources are treated equal, and events are queued up (fifo order). It is only invoked when the simple scheduler cannot continue. So yes, there are probably differences. I am a bit surprised that Equeue (which is part of Ocamlnet, btw) is not recognized as monadic threading library, although it was definitely the first public Ocaml library exploring this idea (beginnings in 1999), and has probably the largest user code base (remember the original wink.com search service was written with it). It was "only" never been announced as monadic, and uses a different terminology because it's a threading library in the first place, and I always hoped it's easier to understand for people without Haskell background. Gerd -- ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de Creator of GODI and camlcity.org. Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de *** Searching for new projects! Need consulting for system *** programming in Ocaml? Gerd Stolpmann can help you. ------------------------------------------------------------