|
Yes. Probably. But you must realise that writing too many threads for several functions at the same time will probably not work out to be more economical than using few (maybe three or four) threads at one time, especially if all the threads work on some common data. This will keep locking up resources alternatively and could slow down the progress. On the other hand, threads which do totally different things (like GUI threads vs. worker threads) could be more effective.
Restrict the total number of threads running at one time. It all depends on the calculations being used and how the data is being accessed through your program.
Threads are nice. But depending on the situation, it might or might not work out. You'll need to experiment a bit.
My suggestion is that you should not use more than three or four threads running at the same time.
Effectiveness of threads also depend on your OS because at the base level, the OS controls the tasking and generally the effectiveness is determined by how the multitasking is handled at the OS level.
In the end, it all comes down to experimentation with your program and tweaking it. Sometimes it might work out that slightly optimizing the program in other ways than threading might help.
|