[Stackless] my uthreads execute sequentially...

Wolfgang Lipp wlipp at web.de
Fri Jan 12 16:31:49 CET 2001



can anybody help me with this problem? i am using stackless python 2.0 on win98se, on a laptop. when i execute the following program:

    import uthread9 as uthread
    import time

    def timer_elapsed( started ):
        return time.time() - started

    def timer_over( started, stoptime ):
        return timer_elapsed( started ) > stoptime

    def timer( letter, stoptime ):
        started = time.time()
        print "%s is started" % letter
        while not timer_over( started, stoptime ):
            pass
        print '%s is done after %3.2fs' % ( letter, timer_elapsed( started ) )

    uthread.new( timer, 'a', 5 ) 
    uthread.new( timer, 'b', 3 ) 
    uthread.new( timer, 'c', 2 ) 

    uthread.run() 

my output looks like this:

    a is started
    a is done after 5.05s
    b is started
    b is done after 3.02s
    c is started
    c is done after 2.04s

which clearly indicates that the threads do *not* run in the parallel. moreover, the outputs from all the examples on http://world.std.com/~wware/uthread.html also point into interpreting them as being executed one thread after the other. since all the snippets as well as the test suite u1.py from that page work without complaining, i guess that there is no problem with my installation. 

furthermore, i tried a few examples using the threading module, and the results appear to be ok. because of this and because uthreads are not, to my understanding and unlike the threading module, dependent on the os, it can't be my laptop that's to small to fit in threads :-| ...

can anyone help me parallelize my uthreads?


yours, 

-wolf



    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20010112/7b9c512e/attachment.htm>


More information about the Stackless mailing list