Exercise for CC++: Foster chapter 5 exercise 3. (see Foster 2.5.2, for relevant discussion) Due March 27 As a starting point, here is solution to exercise 2 (Please note that this is an implementation sketch not an actual program, since we don't have a CC++ compiler. You are asked to do the same. Also note that your design here can be a basis for your cyclehunt solution) int counter =0; // task void f(int index, int para, int *Ans) { Ans[index] = "computed using para"; } atomic int getcounter() { return counter++; } main(int ac, char* av[]) { int parameter[], Ans[]; int p = atoi(av[1]); // "number of workers"; int N = 0; // "total number of parameters" /* saunders' insertion to emphasize the power of stl vectors. * Vectors have all features of arrays, but offer significantly more convenience, * including dynamic size, with virtually no performance loss. */ // Suppose parameter list from standard input. vector parameter; // alternative declaration: 0 is initial size. while (cin) {cin >> para; parameter.push_back(para); ++N;} // vector grows as needed. vector Ans(N); // alternative declaration: runtime size easily used // end of insertion int i, k; parfor(i=1; i<=p; i++) { f(i, parameter[i], Ans); k=getcounter(); while(k<=N) { f(k, parameter[k], Ans); k = getcounter(); } } }