concurrency program design stackless python tasklet or python thread?

Discussion in 'Python' started by davy zhang, Nov 11, 2008.

  1. davy zhang

    davy zhang Guest

    first here is my basic idea is every actor holds their own msg queue,
    the process function will handle the message as soon as the dispatcher
    object put the message in.

    This idea naturally leads me to place every actor in a separate thread
    waiting for msg

    but the rumor has it, stackless python with tasklet and channel can do
    much more better in concurrency program, so I dive my head into it.

    but I found the tasklet is really a lined-up sequence , that means if
    a tasklet blocked or do some time consuming calculation, the other
    tasklets can not get the cpu slice

    so we must design very carefully to avoid the big job for single task

    I am just confused why the stackless python is said to be good at
    concurrency program model or just I get a wrong idea to practice?
    davy zhang, Nov 11, 2008
    #1
    1. Advertising

  2. davy zhang

    Aahz Guest

    In article <>,
    davy zhang <> wrote:
    >
    >first here is my basic idea is every actor holds their own msg queue,
    >the process function will handle the message as soon as the dispatcher
    >object put the message in.


    Sounds like a standard design.

    >This idea naturally leads me to place every actor in a separate thread
    >waiting for msg
    >
    >but the rumor has it, stackless python with tasklet and channel can do
    >much more better in concurrency program, so I dive my head into it.
    >
    >but I found the tasklet is really a lined-up sequence , that means if
    >a tasklet blocked or do some time consuming calculation, the other
    >tasklets can not get the cpu slice
    >
    >so we must design very carefully to avoid the big job for single task
    >
    >I am just confused why the stackless python is said to be good at
    >concurrency program model or just I get a wrong idea to practice?


    Well, you have to be a bit careful, but Stackless is definitely one good
    approach to handling your design. For example, EVE Online is an MMORPG
    written in Python with a similar design. That said, I personally have
    trouble wrapping my brain around Stackless, so I'd probably choose a
    different technique.
    --
    Aahz () <*> http://www.pythoncraft.com/

    "It is easier to optimize correct code than to correct optimized code."
    --Bill Harlan
    Aahz, Nov 11, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TheDustbustr

    stackless python: continuation module?

    TheDustbustr, Jul 25, 2003, in forum: Python
    Replies:
    2
    Views:
    450
    Christian Tismer
    Aug 6, 2003
  2. Delaney, Timothy C (Timothy)

    RE: Python in Games (was RE: [Stackless] Python in Games)

    Delaney, Timothy C (Timothy), Jun 14, 2005, in forum: Python
    Replies:
    3
    Views:
    277
  3. Aleksandar Radulovic
    Replies:
    0
    Views:
    396
    Aleksandar Radulovic
    Nov 11, 2008
  4. davy zhang
    Replies:
    0
    Views:
    385
    davy zhang
    Nov 13, 2008
  5. Replies:
    4
    Views:
    309
Loading...

Share This Page