On Wed, Nov 13, 2019 at 3:00 AM Daniel Austin <
daniel....@gmail.com> wrote:
>
> Francisco, would you mind describing or pointing to resources that describe the issue you are investigating with regard stacks? How are Rust and Ceu different or the same in this regard and what are the implications? I think I can read between the lines a bit and guess but I'd love to get a complete picture.
I found this link that might help:
https://blog.panicsoftware.com/coroutines-introduction/
Each stackful coroutine (fiber, green thread) keeps its own stack for
local variables when suspending execution.
With 1000 coroutines you'll need 1000 stacks. Having a separate stack
allows the coroutines to suspend at any level of depth in the call
stack.
Stackless coroutines share the main single stack. When resumed, the
coroutine must receive from the caller its own state (local variables,
program counter) which must be preallocated and known in advance.
Hence, stackless systems require some compiler support in order to
infer which functions have to be considered "async" to be modified
accordingly (moving locals to a struct and preparing points of
suspension/resumption).
If a stackless function calls a normal function, this function cannot
suspend since their locals and program counter are not tracked.
Typically, only the main body of an async function is allowed to
suspend.
Lua supports stackful coroutines. Céu trails resemble stackless coroutines.
Regards,
Francisco