In Figure 12.1 on page 263, I noticed the graph starts with 1.
Then I read the following on page 268:
"Therefore, tests of multithreaded performance should normally be mixed with tests of single-threaded performance, even if you want to measure only single-threaded performance. (This issue does not arise in TimedPutTakeTest because even the smallest test case uses two threads.)"
If the smallest test case uses 2 threads, where does the data for 1 thread in Figure 12.1 come from?
Thanks for your help.
The label Number of threads on Figure 12.1 is misleading.
It is in fact number of thread pairs:
...
for (int pairs = 1; pairs <= 128; pairs *= 2) {
...
Each TimedPutTakeTest uses 2 threads (single Producer and single Consumer) even for value 1.
for (int i = 0; i < nPairs; i++) {
pool.execute(new PutTakeTest.Producer());
pool.execute(new PutTakeTest.Consumer());
}
Note: The code in question is available online.