realtime design

Will Stuyvesant hwlgw at hotmail.com
Tue Oct 15 17:41:54 CEST 2002


> [Dennis Lee Bieber]

> ...
> Will Stuyvesant fed this fish to the penguins on Monday 14 October
> ...

Yay, and the fish turns out to be a whale.  Oh no, thats not a fish,
that is a mammal.  A shark then.

> ...
> import Queue
> ...

Much better to use Queue.  Thank you for showing your code.

> def testFunctionC(a):
>         # takes about 4 seconds with a == 19 on my computer,
>         # keeps the cpu very busy
>         tmp = 2L
>         for t2 in range(a):
>             tmp = tmp * 2L
>         while tmp > 0:
>             t2 = 2L * t2
>             tmp = tmp - 1
>         return t2 <> 12345L

I have been looking for some kind of function that keeps the cpu doing C
stuff **very** busy (demonstrates treading.Tread.join(timeout) failure),
with a parameter that gives a linear behavior in time, so
testFunction(2*a) would take twice as long.  But such a test function is
hard to find isn't it.

> ...
> # your exponential equation, apparently the function took 12743msec
> ...

Not mine...I think I found the equation in a Tim Peters posting.  And it 
turns out this notebook is doing that function about 3 times faster than 
yours. *grin*

> ...
> IMPORTANT NOTICE -- Even though ALL cases resulted in a TIMEOUT
> return, the program itself cannot exit until thread-4 finishes its
> calculation!
> ...

That was expected.  Unless that thread can be killed, but it just
is not listening and even keeps the caller from doing things!
What I thought was possible was to have the main program executing
statements at least every 200ms, or 500ms, or even 5000ms for that
matter.  And that is just not to be.   Not using threads anyway.
So for now it is byebye to my idea for modeling realtime software
this way.  

But...it has been fun experimenting and I guess we did learn a
thing or two.  Thanks!


'''
QOTD, about experiment
Bowie's Theorem:
        If an experiment works, you must be using the wrong equipment.
'''



More information about the Python-list mailing list