From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 9C7B0BBAF for ; Thu, 24 Sep 2009 14:14:36 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsADAPn+ukrRVdPEk2dsb2JhbACDAo5IiHg/AQEBAQkJCgkTA6lKgTGPfQEDAgSEFwU X-IronPort-AV: E=Sophos;i="4.44,445,1249250400"; d="scan'208";a="36735756" Received: from mail-yw0-f196.google.com ([209.85.211.196]) by mail1-smtp-roc.national.inria.fr with ESMTP; 24 Sep 2009 14:14:36 +0200 Received: by ywh34 with SMTP id 34so1662542ywh.1 for ; Thu, 24 Sep 2009 05:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=Ovn0OFDeFA9xIm+SuByloIdi4zO/by34oRcCf1JcNSA=; b=Xo8rJpqntodG4W1PfV0W5AFW5ABEp+tkEpYXD9pK07U81L8osOO1z+4+XeqlvzMld1 zLWh8SWQZozcLMyegchZv6OFbMk8Mu7hIy0AwrhQAgAA8lAxcCmkShfApAoSLp/TVwYs DDtjhNJqAeuH4hKm1vqlE6hwvjtzyMUUz+Luc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Rl1ZehNZt/zmBF+R/hxOn2IMJx9j+ROGWZMi2IV6oJ4ngNaGDeeNEj6eKx1qFhToRM EbWfPOEUeC9BIizR4ZhD+vdv9G7h1ZfWGFZkvslytQvZk3ptJBgIBBM6sPk2zU2k401l 6ZzaP3PJAsIJJpzjGqv5f6AGb/b3MY+7QMc1w= MIME-Version: 1.0 Received: by 10.100.24.22 with SMTP id 22mr4068268anx.119.1253794475503; Thu, 24 Sep 2009 05:14:35 -0700 (PDT) In-Reply-To: <200909240247.17560.jon@ffconsultancy.com> References: <200909240105.18288.jon@ffconsultancy.com> <4d1b2df20909231701l2248f7f7w841b1d5ece9aa62e@mail.gmail.com> <200909240247.17560.jon@ffconsultancy.com> Date: Thu, 24 Sep 2009 14:14:35 +0200 Message-ID: <4d1b2df20909240514t1ea2d04hd87ba675e4cc929@mail.gmail.com> Subject: Re: [Caml-list] OC4MC : OCaml for Multicore architectures From: Philippe Wang To: Jon Harrop Cc: caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; ocaml:01 deques:01 ocaml's:01 ocaml:01 2009:98 nursery:98 threads:01 threads:01 wrote:01 heap:01 heap:01 caml-list:01 algorithm:01 variables:02 seems:03 On Thu, Sep 24, 2009 at 3:47 AM, Jon Harrop wrote: > Following your advice, it seems to work perfectly now: :-) > Wow! 2.6x faster on 2 cores is good. ;-) your machine is more generous than ours (which is Intel, not AMD) :-) > That's a really fantastic piece of work. I'll do my best to study it and write > literature about it. May I ask, can you give a rough overview of the design? > For example, is there a separate nursery per thread so each thread can > allocate a certain amount before incurring a global pause? Do you have any > ideas for libraries built on top of this, such as a task parallel library > using work-stealing deques? A few words on the GC's design (that uses stop© algorithm several times) : Heaps : - a set of pages are used to give threads the possibility to allocate memory without interfering with other threads, such as there is no mutex locking at local memory allocation. Each thread borns with an empty page, when it's full, the thread takes another one. - a big heap is shared between all, there is a mutex over it to prevent parallel memory allocation into this one. Collection : - when there are no pages left, a collection stops-the-world and copies living values (of the pages) to the shared heap - when the shared heap is full, a collection stops-the-world and copies all living values (pages+shared heap) to a new shared heap (which can be grow if need be) Special operations : - if there is a blocking operation (e.g. mutex lock or I/O operation), the mechanism is roughly the same as original INRIA OCaml's : it tells the GC that there is no need to stop it when stopping the world. - if there is a thread with no allocation and no blocking operation, the behaviur is the same as INRIA OCaml. The number of pages, the size of a page, and the size of the shared heap can be changed before running a program by setting some environment variables (cf. last lines README file included in the distribution package). -- Philippe Wang mail@philippewang.info