Question: Submit an executable C-program for the task. This includes in particular a corresponding main function. Given is the following program excerpt with the parallel computation
Submit an executable C-program for the task. This includes in particular a corresponding main function.

Given is the following program excerpt with the parallel computation parallel_exec(). After the execution of parallel_exec() by P threads, a sequential computation of the result values is done by the function post_function(). i int working = P; 2 float res-values [P]; 9 5 3 void* parallel_exec (void* id) 4 { int i = *(int *) id; res-values[i] = parallel_comp (); working --; 8 } 6 10 void* post_function(void* arg) 11{ while (working > 0) {} post-processing (res-values); 14 } 12 7 13 n() is executed The function parallel-exec() is executed by P > 1 threads. The function post_fun by one thread. Modify the given program excerpt with PThread condition variables such that the following situation is given: The thread in the function post-function() gets notified by the execution of the function parallel.exec() as soon as the execution of parallel.exec() is finished by P threads
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
