img
.
this out is by counting instructions and dividing by CPU speed. If there is a large discrepancy, you
can infer memory system stalls (see Memory Latency ).
Example 16-3 False Sharing
int a[128];
public class FalseSharing {
int index;
public void run() {
while (MANY_INTERATIONS)
a[index]++;
}
...
for (i = 0; i < 8 ;i++)
new FalseSharing(i * SEPARATION).start();
...
}
Summary
There are numerous machine designs, most of which will not affect our programming decisions.
There are a lot of issues concerning memory coherency, all of which are solved by using proper
locking. For very high performance programs, clever, semiportable cache blocking schemes and
data organization can have an enormous impact.
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks
Home