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.2 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 1021CBC69 for ; Mon, 16 Jul 2007 19:25:07 +0200 (CEST) Received: from ipmail03.adl2.internode.on.net (ipmail03.adl2.internode.on.net [203.16.214.135]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6GHP4H1005906 for ; Mon, 16 Jul 2007 19:25:05 +0200 X-IronPort-AV: E=Sophos;i="4.16,542,1175437800"; d="scan'208";a="116859853" Received: from ppp121-44-3-31.lns4.syd7.internode.on.net (HELO [192.168.1.201]) ([121.44.3.31]) by ipmail03.adl2.internode.on.net with ESMTP; 17 Jul 2007 02:55:02 +0930 Subject: Re: [Caml-list] CallCC using fork (and garbage collected processes) From: skaller To: Richard Jones Cc: Jon Harrop , caml-list@yquem.inria.fr In-Reply-To: <20070716164643.GB26691@furbychan.cocan.org> References: <200707160630.23737.jon@ffconsultancy.com> <1184566043.8152.55.camel@rosella.wigram> <20070716164643.GB26691@furbychan.cocan.org> Content-Type: text/plain Date: Tue, 17 Jul 2007 03:25:01 +1000 Message-Id: <1184606701.6231.28.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 469BA9F0.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0100,:01 bounded:01 threads:01 stack:01 threads:01 stack:01 ocaml:01 meg:98 quarter:98 heap:01 heap:01 sourceforge:01 garbage:01 garbage:01 imho:01 On Mon, 2007-07-16 at 17:46 +0100, Richard Jones wrote: > > However the C method doesn't work, because Unix uses > > linear bounded stacks, and there isn't enough address > > space to create enough stacks. > > This is more of a problem with 32 bit machines. 64 bit machines > shouldn't have an issue. Even on a 32 bit machine I could get > thousands of threads before hitting a limit. Yeah, 16 bit machines have some problems but 32 bits is HEAPS .. woops .. 32 bit machines have some problems but 64 bits is HEAPS .. woops .. :) Yes, more can be done with 64 bits: say you allocate 8 bits for stack choices, that's 256 stacks, 16 bits is 64K .. still of your pair of 32 bit half words, say one half is used up, the 16 bits is half the bits you have left .. just for 64K threads .. which isn't really a lot. Minimum stack size is one 4K page .. 4K x 64K = 256Meg .. a quarter of my RAM wasted .. goto 18 bits and ALL my RAM is wasted (on 1G machine). Yes, 64 bit box does give much higher capacity .. but Felix can run several million threads on the same box without any such problems because it uses linked heap objects instead of a linear stack. One stack is faster than the heap.. it isn't clear that millions of stacks is faster though, especially if you have a good heap manager such as the Ocaml gc. Actually be interesting to measure the relative performance of spaghetti and linear stack on 64 bit box. The one to look at here is MLton IMHO .. since it uses a garbage collected (compacted) linear stack with mmap() extension .. hopefully obtaining the benefits of both linear performance from linear addresing and low resource usage from spaghetti stack implementation. -- John Skaller Felix, successor to C++: http://felix.sf.net