From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 395E4BBAF for ; Thu, 28 Oct 2010 11:01:01 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0BADLYyEzZSMDdgmdsb2JhbAChRBUBAQsLCAcTAx+/LYVIBI1b X-IronPort-AV: E=Sophos;i="4.58,250,1286143200"; d="scan'208";a="76680805" Received: from fmmailgate01.web.de ([217.72.192.221]) by mail4-smtp-sop.national.inria.fr with ESMTP; 28 Oct 2010 11:01:00 +0200 Received: from smtp03.web.de ( [172.20.0.65]) by fmmailgate01.web.de (Postfix) with ESMTP id 738B117197605; Thu, 28 Oct 2010 11:01:00 +0200 (CEST) Received: from [78.43.204.177] (helo=frosties.localdomain) by smtp03.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #24) id 1PBOM0-0000UM-00; Thu, 28 Oct 2010 11:01:00 +0200 Received: from mrvn by frosties.localdomain with local (Exim 4.72) (envelope-from ) id 1PBOLz-00078U-Mz; Thu, 28 Oct 2010 11:00:59 +0200 From: Goswin von Brederlow To: Jeremie Dimino Cc: Goswin von Brederlow , caml-list@inria.fr Subject: Re: [Caml-list] Asynchronous IO programming in OCaml In-Reply-To: <20101027153026.GD32282@aurora> ("Jeremie Dimino"'s message of "Wed, 27 Oct 2010 17:30:26 +0200") References: <20101024225037.GA8999@aurora> <87y69mk6jm.fsf@frosties.localdomain> <20101025111022.GA32282@aurora> <20101025143317.GB32282@aurora> <20101025172633.GC32282@aurora> <877hh4dlog.fsf@frosties.localdomain> <20101027111835.GA5664@gaia> <877hh33g52.fsf@frosties.localdomain> <20101027153026.GD32282@aurora> User-Agent: Gnus/5.110009 (No Gnus v0.9) XEmacs/21.4.22 (linux, no MULE) Date: Thu, 28 Oct 2010 11:00:59 +0200 Message-ID: <87fwvq8zec.fsf@frosties.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: goswin-v-b@web.de X-Sender: goswin-v-b@web.de X-Provags-ID: V01U2FsdGVkX1/y90k0NPNWXrFdFP5H/fVk5u1spGh6vcEvXXeS 1CN4o+gCCchMGfiaKCLH6TQxy7uZGz++1CXJfW1ZG7LLgb7zw3 BsrQiiNTE= X-Spam: no; 0.00; ocaml:01 0200,:01 memcpy:01 commited:01 mfg:98 threads:01 threads:01 wrote:01 caml-list:01 writes:01 writes:01 data:02 data:02 slower:02 kernel:02 Jérémie Dimino writes: > On Wed, Oct 27, 2010 at 03:43:37PM +0200, Goswin von Brederlow wrote: >> But then you tune your benchmark to give you the result you want instead >> of benchmarking what normaly happens. > > That's true for read or write. The point i wanted to make is that in the > general case, i.e. for a system call that blocks, wrapping it into a > thread might not be a good solution because it degrades performances too > much. Hehe, and you have prooven yourself wrong. As you said, when the file isn't cache and the syscall actually blocks there is no time difference. The reasons being that the blokcing takes the majority of time anyway and the context switch for the thread on the read doesn't cost anything since the kernel needs to context switch anyway. :) >> And don't forget. Multi core systems are more and more widely >> spread. What is wrong with 2 cores doing memcpy twice as fast? > > I don't think you can read or write in parallel the RAM with current > architectures, but i may be wrong. NUMA has memory dedicated to each core. Each core can access its memory fast. Accessing some other cores memory on the other hand is slower (and will have to fight for access with that core). >> Do you have a different solution for writes that will avoid threads when >> a write won't block? And how do you restart jobs once the data has >> actually been commited to disk? (i.e. how do you do fsync()?) > > Unfortunately no, we have no solution for write. The main problem i see > with doing write in parallels with threads is to handle errors. > > Jérémie Nah, if you can detect the error then handing is easy. The problem is detecting. Write() itself can fail and that is easy to detect. But write() succeeding doesn't mean the data has been written successfully. You can still get an error after that which you only get on fsync(). MfG Goswin