caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Richard Jones <rich@annexia.org>
Cc: Jon Harrop <jon@ffconsultancy.com>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] CallCC using fork (and garbage collected processes)
Date: Tue, 17 Jul 2007 03:25:01 +1000	[thread overview]
Message-ID: <1184606701.6231.28.camel@rosella.wigram> (raw)
In-Reply-To: <20070716164643.GB26691@furbychan.cocan.org>

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 <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2007-07-16 17:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16  5:30 Jon Harrop
2007-07-16  6:07 ` [Caml-list] " skaller
2007-07-16 16:46   ` Richard Jones
2007-07-16 17:25     ` skaller [this message]
2007-07-16 17:57       ` Tom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1184606701.6231.28.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@ffconsultancy.com \
    --cc=rich@annexia.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).