PDA

View Full Version : When to go for multithreading



OgliX
07-13-2004, 07:08 PM
Hello,
I want to know when one should think of putting rendering into seperate thread. Should I go for it if i'm just getting less fps? or should I have a strong reason than that?

In all I want to know when it's better to go multithreading and when not??An Advice of expert.

marcus256
07-13-2004, 09:42 PM
There are two typical situations that can motivate multi-threading:

1) Your program is doing some CPU hungry task in addition to rendering (e.g. physics calculations), and you want your program to run faster on multi processor systems. Going multithreaded here may be tricky unless you plan the sturcture of your program very carefully. In the GLFW (http://glfw.sourceforge.net) distribution there is an example of how this can be done (see examples/particles.c).

2) You have problems with syncing asynchronous operations (e.g. file I/O, sound playback, rendering etc). Placing asynchronous tasks in separate threads can make programming easier and the program smoother.

However, going multi threaded just to improve rendering performance alone is generally a bad idea. In most situations you will hurt performance.