[rust-dev] Idea: Memcpyed stacks for green tasks

Brian Anderson banderson at mozilla.com
Sat Jan 25 18:31:40 PST 2014


On 01/25/2014 08:58 AM, Bill Myers wrote:
> Stack management for green tasks has been based in the past first on segmented stacks and then on standard large stacks.
>
> However, I just realized that there is a third alternative which might well be better than both of those.
>
> The idea is very simple: a green task would run on a large stack like now, but when it is descheduled, a memory buffer of the size of its used stack space is allocated, and its stack data is copied there; when it is rescheduled, the stack data is copied back to the original address.

That's a really clever idea. There are though a number of situations 
where we unsafely read from or write into other task's stacks that would 
need to be considered carefully.



More information about the Rust-dev mailing list