General Question multi-/hyperthreading

What are best practices to program multithreading?
When should it be used? When shouldn't?
There are no hard-and-fast rules for when or when-not to use multithreading. Though as a general rule, things should be kept as simple as possible unless the case warrants for something more complicated.

Basically, you should keep to single-threading unless you need the performance improvement of parallelisation of multithreading and have the time and expertise in your development team to be able to implement it as multi-threaded or in the case that single threading just won't cut it - eg, you have blocking calls in your code and need the rest of the program to continue execution whilst waiting for the blocking call to unblock. Though in the latter case, a different approach can generally be found.
 
I believe this should be of use. That guy mostly writes about ps3, but he also has several excellent articles on application of multithreading to a number of real-world programming problems.
 
I'm working on an MFD where I NEED the refresh rate to be 0.1 second or less. Since the refresh rate is controlled by the user and the default is 1 second, I was thinking about running this portion of the MFD in a separate thread.

Basically, I simply need a single process to read variables from the API do the calculations and output the response back through the API at a fast rate. This needs to be independent of the user defined refresh rate.

Does anyone know if running this one process in a separate thread is the best way to go or if there is a simpler solution available.

I'd prefer to run at orbiters refresh rate and simply have the display update according to the user defined time.
 
I'm working on an MFD where I NEED the refresh rate to be 0.1 second or less. Since the refresh rate is controlled by the user and the default is 1 second, I was thinking about running this portion of the MFD in a separate thread.

Basically, I simply need a single process to read variables from the API do the calculations and output the response back through the API at a fast rate. This needs to be independent of the user defined refresh rate.

Does anyone know if running this one process in a separate thread is the best way to go or if there is a simpler solution available.

I'd prefer to run at orbiters refresh rate and simply have the display update according to the user defined time.
Look at opcPreStep and opcPostStep.
 
Back
Top