Section
described an implementation of statistical counters that provided
excellent
performance, roughly that of simple increment (as in the C ++
operator), and linear scalability -- but only for incrementing
via inc_count().
Unfortunately, threads needing to read out the value via read_count()
were required to acquire a global
lock, and thus incurred high overhead and suffered poor scalability.
The code for the lock-based implementation is shown in
Figure
on
Page
.
Quick Quiz 11.1: Why on earth did we need that global lock in the first place? End Quick Quiz