Markou moment
This commit is contained in:
		@@ -14,7 +14,7 @@ public class ParallelMax
 | 
			
		||||
    public static void main(String[] args)
 | 
			
		||||
    {
 | 
			
		||||
        // Create a list
 | 
			
		||||
        final int N = 200000000;
 | 
			
		||||
        final int N = 20;
 | 
			
		||||
        int[] list = new int[N];
 | 
			
		||||
        for (int i = 0; i < list.length; i++)
 | 
			
		||||
            list[i] = i;
 | 
			
		||||
@@ -51,7 +51,7 @@ public class ParallelMax
 | 
			
		||||
                    extends RecursiveTask<Integer>
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        private final static int THRESHOLD = 25000;
 | 
			
		||||
        private final static int THRESHOLD = 3;
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        private int[] list;
 | 
			
		||||
@@ -81,9 +81,13 @@ public class ParallelMax
 | 
			
		||||
              {
 | 
			
		||||
                int mid = (low + high) / 2;
 | 
			
		||||
                RecursiveTask<Integer> left = new MaxTask(list, low, mid);
 | 
			
		||||
                System.out.println("left: " + low +", " + high);
 | 
			
		||||
                RecursiveTask<Integer> right = new MaxTask(list, mid+1, high);
 | 
			
		||||
                System.out.println("right: " + (mid + 1) +", " + high);
 | 
			
		||||
                System.out.println("fork right");
 | 
			
		||||
                right.fork();
 | 
			
		||||
                left.fork();             
 | 
			
		||||
                  System.out.println("fork left");
 | 
			
		||||
                left.fork();
 | 
			
		||||
                return new Integer(Math.max(   left.join().intValue(),
 | 
			
		||||
                                               right.join().intValue())
 | 
			
		||||
                                  );
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user