- Bad
work load distribution:
P-1 processor gets 1 array element
1 processor gets the rest
Find the max for each processor: 0, 0, ...., N-P+1
Find the max between maxima: P
Running time: max( 0,0,..,N-P+1 ) + P = N-P+1 + P = N+1
|
- Optimum
work load distribution:
Each processor gets 1/P portion of all array elements
Find the max for each processor: N/P-1, N/P-1, ...., N/P-1
Find the max between maxima: P
Running time: max( N/P-1, N/P-1, ...., N/P-1 ) + P = N/P+1 + P
|
Example:
N = 1,000,000,000 array elements
Serial:
running time = 999,999,999 steps (comparisons)
Parallel with P = 1,000 processors
running time = 1,000,000,000/1,000 + 1 + 1,000
= 1,000,000 + 1 + 1,000
= 1,001,001 steps (comparisons)
|
|