my uthreads execute serially

Mike Fletcher mfletch at tpresence.com
Fri Jan 12 12:54:41 EST 2001


Same here, works fine with 1.5.4 (1.5.2) version of stackless, but doesn't
work for the 2.0 version.  No idea how I missed that, but it's definitely
failing to switch contexts without an explicit switchContext.  I have no
time today to track it down this weekend, maybe Chris can take a look?
(Note, adding a switchContext does make the threads run in parallel, but
that shouldn't be necessary).

uthread9 does complain on my machine, but I'd though it was the posting an
exception to another thread test (which prints out the traceback).  Should
have had an explicit test for such a simple thing I suppose.

Sorry about that,
Mike

-----Original Message-----
From: Wolfgang Lipp
To: python-list at python.org
Sent: 1/12/2001 11:06 AM
Subject: my uthreads execute serially



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






-- 
http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list