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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 273A9BC0A for ; Wed, 6 Jun 2007 00:30:49 +0200 (CEST) Received: from li13-171.members.linode.com (hikaru.yumegakanau.org [69.93.127.171]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l55MUlRJ006433 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 6 Jun 2007 00:30:48 +0200 Received: from tsuyoshi by li13-171.members.linode.com with local (Exim 4.63) (envelope-from ) id 1HvhY7-00086y-DL for caml-list@inria.fr; Tue, 05 Jun 2007 15:30:47 -0700 Date: Tue, 5 Jun 2007 15:30:47 -0700 To: caml-list@inria.fr Subject: re: We should all be forking Message-ID: <20070605223047.GB30586@yumegakanau.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) From: Christopher Cramer X-Miltered: at concorde with ID 4665E417.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; osx:01 osx:01 bug:01 unix:01 kernel:01 btw:02 philosophy:02 guess:04 fork:05 fork:05 long:06 linux:06 relies:06 lazily:07 looks:08 Jon Harrop: > I believe the performance relies upon the Linux kernel lazily copying > the process. Does OSX also do that? It's called copy-on-write and I would be surprised if OSX didn't also do it. The only way to start a new process is to fork, so even if you're just running another program you fork first, and then replace the process image with the new program with exec. If the fork had to copy the entire process image before just throwing it away upon exec, I think Unix, which is based around a philosophy of piping between multiple processes, would have abandoned fork a long time ago. Then again, there is vfork, so I guess they almost did abandon it at one point. This method doesn't work well at all on Windows, as I understand it. BTW your code looks a lot nicer than mine. The |> is brilliant, I think. I'm a little surprised you cut the speed in half without using select. And looking at your code I just realized I have a bug in mine...