March 3. 2022 7. (5 points) The following function implements a common serial algorithm to find the largest value in an
Posted: Fri May 20, 2022 6:34 pm
March 3. 2022 7. (5 points) The following function implements a common serial algorithm to find the largest value in an array. double findLargest (double* array, long size) { long i; double largest = array[0]; for (i=0; i<size; i++) { if (array > largest) largest = array; } return largest; } Design a thread function to solve the same problem using Pthreads. Be sure to identify: allocation of variables to support shared and thread-specific data, (Global vs Local variables) how each thread determines the work it is responsible for. Pseudo code is the best way to express your answer. You do not need to deal with the main thread that starts up the threads and initializes the data. You only need to design the thread function and the variables that it accesses.