Home Forums C Programming Parallel Processing in win32

Viewing 1 reply thread
  • Author
    Posts
    • #1988
      serkan
      Participant

      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

    • #3239
      shalizy
      Participant

      You can do but code should be parallel. Here function is same,That’s fine. But No variables b/w  those call should not be shared.

      Example: Parallel programming using By OpenMP API

      #pragma omp sections num_threads(3)
      {
        #pragma omp section
         { 
              Fun1();
         }
           #pragma omp section
         { 
              Fun2();
         }
          #pragma omp section
         { 
              Fun3();
         }
      }

      Then Here three threads execute parallelly.

Viewing 1 reply thread
  • The forum ‘C Programming’ is closed to new topics and replies.