Java Reference
In-Depth Information
peatedly; each iteration generates a random number (which fetches and modifies the shared
seed state) and also performs a number of “busy-work” iterations that operate strictly on
thread-local data. This simulates typical operations that include some portion of operating on
shared state and some portion of operating on thread-local state.
Figures 15.1 and 15.2 show throughput with low and moderate levels of simulated work in
each iteration. With a low level of thread-local computation, the lock or atomic variable ex-
periences heavy contention; with more thread-local computation, the lock or atomic variable
experiences less contention since it is accessed less often by each thread.
Figure 15.1. Lock and AtomicInteger Performance Under High Contention.
Search WWH ::




Custom Search