[Stackless] multi-core processing?

Neutral Robot Boy neutralrobotboy at gmail.com
Sun Jun 15 05:27:35 CEST 2008

alright, so i'm still in 'beginner' mode with stackless here. i did a bit of
reading which suggested that stackless should be able to distribute
processing across multiple cores without trouble, and i decided to write a
really simple script and look at how much of a load it puts on my cpu. the
script is below:

import stackless

def testify(x, i):
    n = 0
    while n < x:
        y = n * x
        n += 1

    print 'done', i, '!'

stackless.tasklet(testify)(10000000, 1)
stackless.tasklet(testify)(10000000, 2)
stackless.tasklet(testify)(10000000, 3)
stackless.tasklet(testify)(10000000, 4)


even though as i understand it stackless has an internal round-robin
scheduler, this seemed like the only way i could think of to try to get it
to distribute tasks across several cores. when i run this, however, i see a
lot of activity on one core and only a little bit of activity on a second
core. total cpu load taken up: 25% or so, never above. so i guess it's
obvious that i'm barking up the wrong tree with this idea. is there a way to
get stackless to distribute tasks across my cores more evenly? and if so, is
25% cpu load a hard-coded upper bound, or is the execution speed of the
script perhaps held up more by memory access, for example?

sorry to newb up the ml, just trying to get a grip on some of the basics
= )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20080615/903f7f91/attachment.htm>

More information about the Stackless mailing list