[pypy-dev] continulet stacks on the heap and other schemes for io/threading

Armin Rigo arigo at tunes.org
Tue Feb 26 19:41:27 CET 2013


Hi,

On Tue, Feb 26, 2013 at 4:08 PM, Maciej Fijalkowski <fijall at gmail.com> wrote:
>> The basis is allocating all stacks as non-movable structures on the heap.
>
> This is essentially done on jitframe-on-heap (as the name suggests) for the JIT.

I think that what Ronny has in mind is different.  Unless I'm
mistaking it, Rust's "tasks" are green threads, but still thread-like
structures, but fully managed by the process.  They each have their
own C-level stack.  That's why you can run 100'000 of them in maybe 1
GB of RAM (rough order of magnitude), but not 1 or 10 million of them.
 CPython's Stackless and PyPy's stacklets allow basically one order of
magnitude more.  For PyPy as well as "hard-switching" Stackless this
comes at the cost of needing to do copies around.  I suppose it's a
trade-off between this cost and the extra memory of green threads, so
I cannot judge a priori which solution is the best --- it probably
depends on the use case.

The jitframe-on-heap branch "just" enables, finally, PyPy's existing
coroutines to be fully JITted.


A bientôt,

Armin.


More information about the pypy-dev mailing list