From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p2PBiJu9010790 for ; Fri, 25 Mar 2011 12:44:22 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArICAAJ/jE3U4xEIkGdsb2JhbACERKEQFAEBAgkJDQcUJYhNqjORIgKBJYNLdwSIL4ga X-IronPort-AV: E=Sophos;i="4.63,242,1299452400"; d="scan'208";a="79063355" Received: from moutng.kundenserver.de ([212.227.17.8]) by mail3-smtp-sop.national.inria.fr with ESMTP; 25 Mar 2011 12:44:21 +0100 Received: from office1.lan.sumadev.de (dslb-188-097-077-012.pools.arcor-ip.net [188.97.77.12]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0M5a7E-1Pne5P4BJo-00xTgt; Fri, 25 Mar 2011 12:44:16 +0100 Received: from [192.168.1.111] (546BE640.cm-12-4d.dynamic.ziggo.nl [84.107.230.64]) by office1.lan.sumadev.de (Postfix) with ESMTPA id 7AC5B5F701; Fri, 25 Mar 2011 12:44:15 +0100 (CET) From: Gerd Stolpmann To: Alain Frisch Cc: Fabrice Le Fessant , caml-list@inria.fr In-Reply-To: <4D8C6694.7060500@frisch.fr> References: <2054357367.219171.1300974318806.JavaMail.root@zmbs4.inria.fr> <4D8BD02D.1010505@inria.fr> <4D8C6694.7060500@frisch.fr> Content-Type: text/plain; charset="UTF-8" Date: Fri, 25 Mar 2011 12:44:13 +0100 Message-ID: <1301053453.8429.276.camel@thinkpad> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:9iMZYdhxgTwOPmbBcOc8k895UTvEmVv4Aw2BvQtzdbk EUwmoIdXwzGYqiL09z/M0d1ABSm40IFqM2v8yi29M7xEBHYgwf zm9Azl7B719OkovnApwGkCk0R4CsjH5JFEj3znH1jglYulcJzP nkfD/WmWWKj6uDjEsMpJefhhDWSZV7+bOaqBLqhghjilACQEkO 8+uPnkeHbKuHfcfRmqLfw== Subject: Re: [Caml-list] Efficient OCaml multicore -- roadmap? Am Freitag, den 25.03.2011, 10:55 +0100 schrieb Alain Frisch: > Hi Fabrice, > > On 03/25/2011 12:13 AM, Fabrice Le Fessant wrote: > > Actually, I had a discussion two weeks ago with Xavier and Damien > > about this issue. There is some kind of agreement that the ocaml way of > > supporting multicore would be to have several runtimes running in the > > same process, in different threads. That way, the GC would still be > > mono-threaded, so almost no speed loss for mono-threaded programs (i.e. > > currently all OCaml programs ;-) ). There would be some kind of "fork" > > function, that would create a new thread running a function in a new > > heap, probably generated by a copy-on-need algorithm. The different > > threads would not share heap memory, but would be allowed to share > > structures outside of their heaps, probably for simple types like > > strings and int/float arrays (or using the Ancient library). > > This sound very reasonable, and it's good to know that the subject is > being discussed. > > What are the advantages of this approach over multi-processing (+ > explicit shared memory)? Multi-processing brings extra isolation and > safety; and it requires no change to the runtime system or the FFI. > > One advantage of the approach you describe is that it would allow to use > native libraries that support multi-threading. Do you see other advantages? It is an interesting approach. There is at least one big advantage: When new memory is allocated that is to be shared by all workers, it is mapped at the same address. In the multi-process design this is difficult to organize - there is no system call for this. The only safe way to get this effect is to allocate memory before new workers are forked (the unsafe way is to manage addresses manually, but this is quickly becoming very OS-dependent). Being able to map shared memory at the same address is important for some uses, especially when ocaml values are moved there directly in the style of Ancient. For my Camlbox data structure I had to work around this issue (and it was feasible), but not all interesting data structures would allow that. Gerd > Cheers, > > Alain > -- ------------------------------------------------------------ Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------