Page 1 of 1

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
by answerhappygod
March 3 2022 7 5 Points The Following Function Implements A Common Serial Algorithm To Find The Largest Value In An 1
March 3 2022 7 5 Points The Following Function Implements A Common Serial Algorithm To Find The Largest Value In An 1 (46.64 KiB) Viewed 29 times
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.