Alternatives to Stackless Python?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • binarybana@gmail.com

    #1

    Alternatives to Stackless Python?

    After recently getting excited about the possibilities that stackless
    python has to offer
    (http://harkal.sylphis3d.com/2005/08/...ckless-python/)
    and then discovering that the most recent version of stackless
    available on stackless.com was for python 2.2 I am wondering if
    Stackless is dead/declining and if so, are there any viable
    alternatives that exist today?

    I found LGT http://lgt.berlios.de/ but it didn't seem as if the
    NanoThreads module had the same capabilites as stackless.

  • Stephan Diehl

    #2
    Re: Alternatives to Stackless Python?

    On Tue, 20 Sep 2005 08:50:44 -0700, binarybana@gmai l.com wrote:
    [color=blue]
    > After recently getting excited about the possibilities that stackless
    > python has to offer
    > (http://harkal.sylphis3d.com/2005/08/...ckless-python/)
    > and then discovering that the most recent version of stackless
    > available on stackless.com was for python 2.2 I am wondering if
    > Stackless is dead/declining and if so, are there any viable
    > alternatives that exist today?[/color]

    Well, it's not dead and the last recent version is for python 2.3
    The developer of stackless, Christian Tismer, is one of the main
    developers of the PyPy project. (http://codespeak.net/pypy)
    For this reason, there is an extremely good chance that the ideas
    behind stackless will survive :-) .
    Visit www.stackless.com for further info.
    ---
    Stephan

    Comment

    • simonwittber@gmail.com

      #3
      Re: Alternatives to Stackless Python?

      > I found LGT http://lgt.berlios.de/ but it didn't seem as if the[color=blue]
      > NanoThreads module had the same capabilites as stackless.[/color]

      What specific capabilities of Stackless are you looking for, that are
      missing from NanoThreads?


      Sw.

      Comment

      • Peter Hansen

        #4
        Re: Alternatives to Stackless Python?

        simonwittber@gm ail.com wrote:[color=blue][color=green]
        >>I found LGT http://lgt.berlios.de/ but it didn't seem as if the
        >>NanoThreads module had the same capabilites as stackless.[/color]
        >
        > What specific capabilities of Stackless are you looking for, that are
        > missing from NanoThreads?[/color]

        While I can't speak for the OP, isn't it the case that the threadlets in
        Stackless (sorry, don't know what they are really called) are true
        threads in the sense of being able to switch contexts no matter how far
        down in a set of nested calls they might be? And that NanoThreads are
        simply generators, which means you can switch contexts only at the top
        level, with a yield statement?

        I don't know what the OP wants, but I could imagine that would be a
        pretty fundamental difference (if I'm right about Stackless).

        -Peter

        Comment

        • D H

          #5
          Re: Alternatives to Stackless Python?

          binarybana@gmai l.com wrote:[color=blue]
          > After recently getting excited about the possibilities that stackless
          > python has to offer
          > (http://harkal.sylphis3d.com/2005/08/...ckless-python/)
          > and then discovering that the most recent version of stackless
          > available on stackless.com was for python 2.2 I am wondering if
          > Stackless is dead/declining and if so, are there any viable
          > alternatives that exist today?
          >
          > I found LGT http://lgt.berlios.de/ but it didn't seem as if the
          > NanoThreads module had the same capabilites as stackless.
          >[/color]

          See also greenlets, which work with regular cpython:

          I've been experimenting with various tools in the py library lately, in preparation for a presentation I'll give to the SoCal Piggies grou...


          You'll probably need to get it via an svn client (such as tortoisesvn on
          windows): http://codespeak.net/py/current/doc/...g-started.html

          Comment

          • Christophe

            #6
            Re: Alternatives to Stackless Python?

            simonwittber@gm ail.com a écrit :[color=blue][color=green]
            >>I found LGT http://lgt.berlios.de/ but it didn't seem as if the
            >>NanoThreads module had the same capabilites as stackless.[/color]
            >
            >
            > What specific capabilities of Stackless are you looking for, that are
            > missing from NanoThreads?[/color]

            Capabilities of the different "threadlike " systems are somewhat muddy.
            What myself I like in stackless is :
            - you can put context switching instuctions anywhere in the callstack
            without having to explicitely chain the operation
            - pickle support

            Not sure if greenlets support pickling yet. There are no info on that
            point and my tests weren't succesful.

            Comment

            • Olivier Dormond

              #7
              Re: Alternatives to Stackless Python?

              Christophe wrote:[color=blue]
              > simonwittber@gm ail.com a écrit :
              >[color=green][color=darkred]
              >>> I found LGT http://lgt.berlios.de/ but it didn't seem as if the
              >>> NanoThreads module had the same capabilites as stackless.[/color]
              >>
              >> What specific capabilities of Stackless are you looking for, that are
              >> missing from NanoThreads?[/color]
              >
              > Capabilities of the different "threadlike " systems are somewhat muddy.
              > What myself I like in stackless is :
              > - you can put context switching instuctions anywhere in the callstack
              > without having to explicitely chain the operation
              > - pickle support
              >
              > Not sure if greenlets support pickling yet. There are no info on that
              > point and my tests weren't succesful.[/color]

              The greenlets play with the underlying CPU stack directly so I don't
              think they could ever be pickled.

              Comment

              • Christophe

                #8
                Re: Alternatives to Stackless Python?

                Olivier Dormond a écrit :[color=blue]
                > Christophe wrote:
                >[color=green]
                >> simonwittber@gm ail.com a écrit :
                >>[color=darkred]
                >>>> I found LGT http://lgt.berlios.de/ but it didn't seem as if the
                >>>> NanoThreads module had the same capabilites as stackless.
                >>>
                >>>
                >>> What specific capabilities of Stackless are you looking for, that are
                >>> missing from NanoThreads?[/color]
                >>
                >>
                >> Capabilities of the different "threadlike " systems are somewhat muddy.
                >> What myself I like in stackless is :
                >> - you can put context switching instuctions anywhere in the callstack
                >> without having to explicitely chain the operation
                >> - pickle support
                >>
                >> Not sure if greenlets support pickling yet. There are no info on that
                >> point and my tests weren't succesful.[/color]
                >
                >
                > The greenlets play with the underlying CPU stack directly so I don't
                > think they could ever be pickled.[/color]

                Then they are useless for nearly all the uses cases I need them :/ And
                that's why stackless is still relevant here. Or maybe pypy too but it's
                still a long time to go.

                Comment

                • simonwittber@gmail.com

                  #9
                  Re: Alternatives to Stackless Python?


                  Peter Hansen wrote:[color=blue]
                  > While I can't speak for the OP, isn't it the case that the threadlets in
                  > Stackless (sorry, don't know what they are really called) are true
                  > threads in the sense of being able to switch contexts no matter how far
                  > down in a set of nested calls they might be? And that NanoThreads are
                  > simply generators, which means you can switch contexts only at the top
                  > level, with a yield statement?
                  >
                  > I don't know what the OP wants, but I could imagine that would be a
                  > pretty fundamental difference (if I'm right about Stackless).
                  >[/color]

                  Yes, NanoThreads are very different to Stackless. I was curious to see
                  what the OP's requirements were, to determine if the requirement could
                  possibly be implemented using NanoThreads. A NanoThread is not required
                  to be a generator, it only has to look and work like a generator, which
                  opens up the possibility of implementing a custom NanoThread using a
                  normal Python class.

                  Sw.

                  Comment

                  • binarybana@gmail.com

                    #10
                    Re: Alternatives to Stackless Python?

                    Honestly I am not knowledgeable about either option but mainly I was
                    specifically targetting my feature set towards the things that a higher
                    level game engine would need such as the one described here:

                    Which I guess the main difference that I see between stackless and
                    NanoThreads is the ability to communicate between threads through
                    channels and other methods. This is very important in games where the
                    actors need to communicate among each other to create interactive and
                    interesting gameplay.

                    And perhaps scheduling overhead, memory costs and slow thread creation
                    could be otherh areas where the two differ (but I am unsure). And
                    finally, how good is NanoThreads at non-preemptive multithreading and
                    event-driven control? These are more areas that I see the two possibly
                    differing.

                    Also, Greenlets look really interesting, I will have to evaluate these
                    more closely.

                    Comment

                    • Christian Tismer

                      #11
                      Re: Alternatives to Stackless Python?

                      Peter Hansen wrote:
                      [color=blue]
                      > simonwittber@gm ail.com wrote:
                      >[color=green][color=darkred]
                      >>>I found LGT http://lgt.berlios.de/ but it didn't seem as if the
                      >>>NanoThread s module had the same capabilites as stackless.[/color]
                      >>
                      >>What specific capabilities of Stackless are you looking for, that are
                      >>missing from NanoThreads?[/color]
                      >
                      >
                      > While I can't speak for the OP, isn't it the case that the threadlets in
                      > Stackless (sorry, don't know what they are really called) are true
                      > threads in the sense of being able to switch contexts no matter how far
                      > down in a set of nested calls they might be? And that NanoThreads are
                      > simply generators, which means you can switch contexts only at the top
                      > level, with a yield statement?
                      >
                      > I don't know what the OP wants, but I could imagine that would be a
                      > pretty fundamental difference (if I'm right about Stackless).[/color]

                      You are.

                      --
                      Christian Tismer :^) <mailto:tismer@ stackless.com>
                      tismerysoft GmbH : Have a break! Take a ride on Python's
                      Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/
                      14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
                      work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05
                      PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
                      whom do you want to sponsor today? http://www.stackless.com/

                      Comment

                      • Christian Tismer

                        #12
                        Re: Alternatives to Stackless Python?

                        Christophe wrote:
                        ....
                        [color=blue]
                        > Not sure if greenlets support pickling yet. There are no info on that
                        > point and my tests weren't succesful.[/color]

                        Greenlets refine a concept of Stackless 2.0 which was orthogonal
                        to the Python implementation in a sense that they did not
                        conflict at all. This is less efficient than collaborative
                        task switching, but allows greenlets to exist without any
                        maintenance.

                        A Stackless subset based upon Greenlets is in discussion.

                        Platform independent Pickling support of running tasklets is
                        almost impossible without support from the Python implementation.
                        I see this as an entry point for people to try these ideas.
                        The switching speed is several times slower by principle.

                        ciao - chris

                        --
                        Christian Tismer :^) <mailto:tismer@ stackless.com>
                        tismerysoft GmbH : Have a break! Take a ride on Python's
                        Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/
                        14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
                        work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05
                        PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
                        whom do you want to sponsor today? http://www.stackless.com/

                        Comment

                        Working...