Although, on second thought, one could just free the unused part of the user
mode stack whenever a thread blocks, either in the user mode code (i.e. using
madvise MADV_DONTNEED or equivalent to discard everything below the stack
pointer modulo the page size, perhaps minus the page size) or automatically in
a modified kernel, and thus greatly reduce the worst case.
It's still going to have higher overhead than the CPS continuations on the
heap, because the stack will tend to have holes where dead variables live, for
aligning to page boundaries, and you also keep around the kernel stack and
kernel scheduler objects.
And it doesn't work on 32-bit, because you cannot have more than around 2048
tasks with megabyte-sized task stacks (which is way too low for several
usages), and unfortunately there are lots of 32-bit-only smartphones and
tablets that should probably be supported.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev