[Stackless] stackless-tealet

Kristján Valur Jónsson kristjan at ccpgames.com
Thu Sep 5 08:27:19 CEST 2013

The chief drive is architectural:
It makes sense to have stack slicing performed by a separate library that is easily testable on its own and which provides a robust interface to the caller.
This also reduces "coupling" in the code.
But the tealets also use smarter stack management.  The tealet code is evolved from the greenlet module, which Armin Rigo created based on Stackless.
But he added  a "just in time" stack saving feature, which means that we need not have a fixed "stack base."  This allows us to get rid of the "climb_stack_and*" functions and various other bits of magic nudges here and there.  It should also reduce the amount of memory used by hard switched tasklets.
In tealet, I iterated on this a bit, so that "tealets" can be duplicated, and share the same stack.  Also, just-in-time growth now happens with additional malloc calls, not realloc, which is more efficient.
An upshot of this stack management regime is that tealets work only by executing a function as a new tealet.  It is not possible to capture the current execution point, because a function provides a fixed boundary to the possible stack use of that tealet (you cannot return from the function and  pop the stack and still be in the same tealet)  whereas capturing the stack does not.  This forced me to change the way that the "main" tasklet is executed.

In short: Architectural niceness, and hopefully simpler platform support since platform support is part of the separate, smaller, and easily testable, tealet module.  
In addition, hopefully faster switching with less memory use.  
For the latter case, I really should gather some metrics, of course :)

-----Original Message-----
From: stackless-bounces at stackless.com [mailto:stackless-bounces at stackless.com] On Behalf Of Anselm Kruis
Sent: 4. september 2013 14:39
To: stackless at stackless.com
Subject: Re: [Stackless] stackless-tealet

What are the key benefits we get from tealet? I wonder, if there is any compelling reason to change the 2.7 implementation.

About the license: I always choose Apache License 2.0 as suggested by the Python Software Foundation License FAQ https://wiki.python.org/moin/PythonSoftwareFoundationLicenseFaq#Contributing_Code_to_Python.


Am 02.09.2013 12:46, schrieb Kristján Valur Jónsson:
> Ah,
> Well, the code is in the repo, and it was approved by Christian.  He 
> even closed the old branch :) 
> https://bitbucket.org/krisvale/stackless-tealet
> I guess I'm just waiting for some more general concensus that this is a good plan.
> I also suppose I need to set up a license for the tealet stuff, but Armin has basically just decleared lost interest in the project and doesn't care about it.
> I think I"ll just slap the same Python license on It that stackless 
> has :)
> K
>> -----Original Message-----
>> From: stackless-bounces at stackless.com [mailto:stackless- 
>> bounces at stackless.com] On Behalf Of Richard Tew
>> Sent: 2. september 2013 02:20
>> To: The Stackless Python Mailing List
>> Subject: Re: [Stackless] stackless-tealet
>> Any progress with this Kristjan?
>> _______________________________________________
>> Stackless mailing list
>> Stackless at stackless.com
>> http://www.stackless.com/mailman/listinfo/stackless
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless

  Dipl. Phys. Anselm Kruis                       science + computing ag
  Senior Solution Architect                      Ingolstädter Str. 22
  email A.Kruis at science-computing.de             80807 München, Germany
  phone +49 89 356386 874  fax 737               www.science-computing.de
Vorstandsvorsitzender/Chairman of the board of management:
Gerd-Lothar Leonhart
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Michael Heinrichs, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board:
Philippe Miltin
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list