Question: Concurrent and Parallel Programming Given below is a sequential program to find the minimum value in an integer array of 1,000,000 values. Your task is
Concurrent and Parallel Programming
Given below is a sequential program to find the minimum value in an integer array of 1,000,000 values. Your task is to write a parallel version using callable thread interface public class MinValue { public static void main(String[] args) { int f[] = new int[1000000]; for(int j = 0; j < f.length; j++) f[j] = (int)(Math.random()*1000); //find min value int min = f[0]; for(int j = 1; j < f.length; j++) if(f[j] < min) min = f[j]; System.out.println("Minimum value = "+ min); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
