Hi Tomas,

> > broken as soon as coroutines are used. A single coroutine is limited
> > in stack size (but in turn there may be an unlimited number of
> > coroutines, again needing an unlimited stack).
> 
> When the first coroutine is started, does it affect the original stack
> size and limit?  Or is the first/main "coroutine" always without the
> stack restriction?

No, it is also restricted, but to 4 times the stack segment size of
other coroutines (see doc/refS.html#stack).


> What I initially use a lot of stack and then create
> a coroutine?

Before any coroutine is started, the stack is potentially unlimited.
When the first coroutine is started, however, and it finds that the
stack is already larger than that 4x limit, an error is thrown.


> Are the coroutine stacks allocated on the hardware stack
> too?  In that case, how are coroutines garbage collected?

Yes. The stack segments grow downwards on the hardware stack.

The garbage collector knows about them, and traverses all coroutine
segments which are in use. When a coroutine terminates or goes out of
scope, its stack segment is freed.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to