473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Priority based concurrent execution

Hi,

I have a simulation application (PlayerStage) in which the robot is asked
every ~200ms for an action. In the meantime the robot has to do some
calculation with the perception. As the calculation gets more and more time
consuming I am thinking about outsourcing it into a concurrently running
method. If the calculation takes too long it would be ok for the result to be
incorporated in some future cycle of the main loop, resulting in the
calculation being done less and less often and the main loop executing some
stop behavior.
My question: Is there a possibility in Python (either with the threading
module or with Twisted's non-threading style) to prioritize the two
(pseudo-)concurrent methods so that the main tread is further on executed
every ~200ms and the calculation thread being executed only in "idle" time
slots?

Thanks,
wr
Sep 21 '06 #1
1 1295

Willi Richert wrote:
Hi,

I have a simulation application (PlayerStage) in which the robot is asked
every ~200ms for an action. In the meantime the robot has to do some
calculation with the perception. As the calculation gets more and more time
consuming I am thinking about outsourcing it into a concurrently running
method. If the calculation takes too long it would be ok for the result to be
incorporated in some future cycle of the main loop, resulting in the
calculation being done less and less often and the main loop executing some
stop behavior.
My question: Is there a possibility in Python (either with the threading
module or with Twisted's non-threading style) to prioritize the two
(pseudo-)concurrent methods so that the main tread is further on executed
every ~200ms and the calculation thread being executed only in "idle" time
slots?

Thanks,
wr
Hi,

I suggest taking a look a PEP 342
http://www.python.org/dev/peps/pep-0342/. The new coroutines capability
in Python 2.5 seems to be intended for exactly what you are doing.

--
Doug Fort, Consulting Programmer
http://www.dougfort.com

Sep 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Joe Wong | last post by:
Hi, Is there any way to increase/decrease a thread priority in Python? Best regards, -- Wong
4
by: Trev Hunter | last post by:
Hi All, I was just wondering if it is safe to change thread priorities with thread pool threads (threads used by System.Threading.Timer and those used by the ThreadPool class itself). Say I...
5
by: Richard L Rosenheim | last post by:
I'm looking to write a program that operates at the lowest execution priority possible. That is, I want the program to basically run in the background having as little impact on the performance of...
38
by: Aaron W. LaFramboise | last post by:
Hello, I understand that an easy way to make the standard std::priority_queue stable is by including an integer stamp with each node that is incremented each time a new node is pushed into the...
11
by: Durai | last post by:
Hi All, I tested "concurrent testing" in MySQL. It works fine. But I couldn't do in PostgreSQL 7.3.4 on HPUX IPF. I got deadlock problem. I used the PHP script to update table( one script...
4
by: Harry J. Smith | last post by:
How can a program change its execution priority in the operating system while it is running? -Harry
1
by: mrudulav | last post by:
Hi I am using Mysql 4.0.18 and executing concurrent insert statement. I am executing this statement in the loop. For first few interation the perofrmace is quite good, the query executes in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.