Hi I am trying to understand how the stack in cilk are managed, reading the ABI doc and the code did not help me too much.
For a spawn, is the spawned function (task) to be executed on the
current stack (of the spawnning function), or to be on a new stack. If
one a new stack, is the new stack allocated by the runtime?
2. if a thief worker steals the continuation of a spawn, is the continuation on a new stack?
my understanding is that if the spawned function to be on the currrent
stack, then the continuation has to be on a new stack; if the spawned
function to be on the new stack, and then the continuation could be on
the current stack (of the spawnning function). For performance reason
and work-first policy, it looks to me that the spawned function will be
on the current stack, and only when there is steal, the continuation
will be started on the new stack which could be allocated by the thief.
If this is correct, how the stack is duplicated to allow the
continuation to run?
I hope my questions are not too far from the baseline of the cilk runtime. The similar questions could also be asked for sync.