Subject: Re: [boost] [coroutine] : My Confusion
From: Christopher Kormanyos (e_float_at_[hidden])
Date: 2012-05-08 19:03:23
>> But how can you approach the dream of generic context switching?
> boost.coroutine uses boost.context for context switching and therefore
> you have to add support for the numerous architectures to boost.context
> in order to get boost.coroutine working on those CPUs.
>> * Can the remarkable Boost.Coroutine be adapted to other CPUs?
>> * How?
> adapt boost.context for the specific architecture/ABI
> regards, Oliver
Wow! This is really cool! I really appreciate what you
are doing here! (Hut ab! Einfach Klasse!)
It looks like you have really done your homework on this one.
But I am still having difficulties identifying the context switch.
In cooperative multitasking, the compiler *knows* which
registers will be clobbered. Boost.Context has an abstraction of
the clobbered registers, the stack pointer and the return address
after subroutine call. And, yes, you do note in the doc that the
cooperative task switch may be significantly more efficient than
the preemptive one.
Upon task yield, you need to store the coroutine's context in some
kind of a task control block (the context). And you need to subsequently
restore this context prior to rescheduling the task.
In the past, I would always pass a pointer to an abstraction of the
context to an assembly routine that was responsible for
* task switch
* context-restore and task re-scheduleWhere are these things in Boost.Coroutine?
Where is the low-level assembly that does the *nuts-and-bolts*
of the context switching?
Or am I just totally confused here? Are you doing it in
a high-level abstraction that I simply don't understand?
Are you using proprocessor macros to do the context switch?
Where is the assembler stuff?
Thank you and best regards.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk