Ilya Zakharevich on Thu, 16 Dec 2004 22:54:36 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Two stacks at once

On Thu, Dec 16, 2004 at 02:21:27PM +0100, Bill Allombert wrote:
> 1) Stack overflow might happen in either stacks, so we have to allocate
> a suitable amount for each stacks. 

In practice, I think that 2 stacks of 3M should work as well as one of
4M; so it is a price of 2M for the default configuration.  And if it
is a custom-made stack size, one could custom-modify it without a
large pain.  Given the memory situation of today, I do not think that
extra 30% of virtual memory would matter.

> 2) We cannot allow recursive objects in a stack to include pointers to the 
> other stack, else we will not be able to garbage collect.

You get anything on another stack only if you ask for it.  So how it
can hurt?

> 1) Given 2) above, making sure objects are created in the correct stack
> without requiring extra copy can be painful.

My hope was that no change to existing code is *needed*.  One *can*
use stack switching to optimize performance.  If it is used often
enough, one gets the "stack randomization effect" described above,
when you may use each-stack-of-lower size for the same calculation.

> 2) Most of the time lazy garbage collecting is nearly as good as a
> multi-stack approach.  Karim have developed fast gerepile alternative
> that have nearly the same cost as a copy.

How a copy can be as good as 6 assignments?

> 3) Switching stacks has a cost.

See above.

Hope this helps,