[Mono-dev] Monoco, couroutines and Mono.
Tomi Valkeinen
tomba at iki.fi
Thu Apr 16 01:41:02 EDT 2009
Hi,
On Wed, 15 Apr 2009, James Mansion wrote:
> Tomi Valkeinen wrote:
>> I think you mean OS thread. The coroutines are nothing special, they are
>> similar to any other jitted code that mono produces.
> Well, except that the core has some knowledge of them now, right?
Well, some, of course. But a continuation is just a piece of stack, stored
somewhere. The jitted code itself is the same as normally.
>> And thus the stack has to be the normal continuous OS stack.
> Thus? Why? You probably need to pin stack areas, but why can't you malloc
> (or mmap) some new space
> and place a stack in it? I think you'll find that Steve Dekorte's libcoro
> does that. If you are prepared to
> forgo guard pages and the like (or roll your own handler) then I don't see
> why the stack pointer absolutely
> has to be where you expect. And in fact the gubbins that normally gets
> pushed to the main CPU stack
> can get pushed to a fully software stack anyway, just as you do on RISC
> systems with no push/pop
> abstraction. The stack pointer is just a pointer, after all.
The stack must be able to grow, otherwise we may run out of stack. If we
want to manage a proper stack for each continuation, we need to allocate
it in page sized chunks, and we need the guard pages. This would increase
the required memory needed for each continuation quite a bit.
Also, the stack contains pointers to variables in the stack, so the stack
has to be in the same memory location.
Tomi
More information about the Mono-devel-list
mailing list