[Python-ideas] Cofunctions PEP - Revision 4
Christian Tismer
tismer at stackless.com
Sat Oct 13 15:11:43 CEST 2012
Hi Greg,
digged this thing up while looking into the current async discussion.
On 14.08.10 03:22, Greg Ewing wrote:
> M.-A. Lemburg wrote:
>
>> Greg Ewing wrote:
>
>>> In an application that requires thousands of small, cooperating
>>> processes,
>
>> Sure, and those use Stackless to solve the problem, which IMHO
>> provides a much more Pythonic approach to these things.
>
> At the expense of using a non-standard Python installation,
> though. I'm trying to design something that can be incorporated
> into standard Python and work without requiring any deep
> black magic. Guido has so far rejected any idea of merging
> Stackless into CPython.
>
> Also I gather that Stackless works by copying pieces of
> C stack around, which is probably more lightweight than using
> an OS thread, but not as light as it could be.
>
So, here I need to correct a bit.
What you are describing is the behavior of stackless 2.0,
also what the greenlet does (and eventlet then too for now).
The main thing that makes stackless 3.x so difficult _is_ that
it is as efficient as can be, because no stack slicing is done,
for 90 % of all code.
Stackless uses operations to unwind the C stack in most cases.
If this were possible in _all_ cases, then all the stack copying
would go away, and we had no machine code at all!
But the necessary change to Python would be quite heavy,
undoable for a small team.
I have left these ideas long time ago and did other projects.
But maybe things should be considered again, after the world
has changed so much. Maybe Python 4 could be decoupled
from the C stack.
cheers - Chris
--
Christian Tismer :^) <mailto:tismer at stackless.com>
Software Consulting : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/
14482 Potsdam : PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776 fax +49 (30) 700143-0023
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Python-ideas
mailing list