Click to See Complete Forum and Search --> : Parallel Processing in win32


Rajesh1978
July 20th, 2007, 03:50 AM
Hi,
I am new to the forum. I am doing some kind of C++ programming.
which is win32 console application in a .NET IDE

Actually I had 10 different objects they call a particular function to accomplish their task. for eg

MyObject1 *obj1 = new MyObject1();
obj1->dosomething();

MyObject2 *obj2 = new MyObject2();
obj2->dosomething();

MyObject3 *obj3 = new MyObject3();
obj3->dosomething();
........................

what happens the dosomethings() function is called sequencially and done one after another and takes 10 second.

Can I reduce the time by making use of threads. How to know about threads as beginner. Any site which is useful as a tutorial for me.

Please suggest
thanks

kirants
July 20th, 2007, 01:47 PM
Can I reduce the time by making use of threads.Hard to say. If you are running this on a single CPU, be aware that , even if you have multiple threads, their code all will have to finally get executed on that one CPU. So, there probabably won't be much speed gain. That is not the case if you have multiple CPUs. Again, this is a simplistic answer and there is a lot that the OS will do when threads are involved, depending on the total no. and the priorities with which they run and such.

In most cases, threads are used to keep the UI responsive and push the real work to a background thread ( commonly called worker thread ). This is sometimes more desirable than getting the job done faster.
How to know about threads as beginner. Any site which is useful as a tutorial for me.
Please search codeguru.com -> Articles for thread and you will hit quite a few articles. Not all may be what you are looking for, but , you should find beginner level articles like below:
http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4009/
http://www.codeguru.com/cpp/w-p/system/threading/article.php/c5791/
http://www.codeguru.com/cpp/w-d/dislog/threads/article.php/c5027/
http://www.codeguru.com/cpp/w-p/win32/tutorials/article.php/c9823/