Esempio n. 1
0
int main( int argc, char **argv ){
   
   Stopwatch timer;


   // For each circular search vector size
   for(int l=0; l < 4; l++){
      std::cout << br << "\nCircular Search Size: " << vectorSize[l] << "\n";

      // Big V
      for(size_t v = 0; v < BIG_V_SIZE; v++){
         std::cout << "V[" << v << "] - circularSize: " << LITTLE_V_SIZE + vectorSize[l] << "\n";
         V[v] = generateRandomVector(BIG_V_SIZE);
         
         
         pid_t pid;

         int g = 0;

         pid_t pID = fork();
         if (pID < 0) { std::cerr << "Failed to fork" << std::endl;exit(1);}

         if (pID == 0) { //child

            g = 0;
            std::cout << "Child Process" << g << std::endl;

            
         } else { // parent

            std::cout << "Parent Process:" << g << std::endl;;
            ++g;
         }

         // little v 
			for(int i = 0; i < LITTLE_V_SIZE + vectorSize[l]; i++){

            // std::cout << i << ":" << i%LITTLE_V_SIZE << ":" << V[v][i%LITTLE_V_SIZE] << ", ";

            TV[i%vectorSize[l]] = V[v][i%LITTLE_V_SIZE];
			}
      }
   }


	 timer.stop();
    std::cout << "\n\noperation took " << timer.total() << " seconds\n";
	 return 0;
}