2
Non-concurrent code:
• for( i=1; i < n; ++i )
  b[i] = (a[i] + a[i-1]) / 2.0;
What we’d like to be able to do:
Example: Average-Neighbors
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.1
0.0
2.1
4.3
0.7
0.1
5.2
8.8
0.2
1.1
3.2
2.5
0.4
2.7
6.7
4.5
a
b
...
...
Thread 1
Thread 2
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.1
0.0
2.1
4.3
0.7
0.1
5.2
8.8
0.2
1.1
3.2
2.5
0.4
2.7
6.7
4.5
a
b
...
...