per-CPU counters and locking
Posted Feb 5, 2006 0:35 UTC (Sun) by
giraffedata (subscriber, #1954)
In reply to:
Mean value by madscientist
Parent article:
The search for fast, scalable counters
Who said anything about semaphores with per-CPU counters? The article specifically said there is no locking required for updating a per-CPU counter. It says you never read a per-CPU counter.
Also, there is no locking required to read the global counter.
Now as for the orthogonal issue of getting a complete count instead of just reading the global counter: how are you going to read the per-CPU counter of another CPU? The only way is for that CPU to write it out to main memory and for you to go to main memory to get it. That takes a long time, and that's the slowness that per-CPU counters are supposed to eliminate.
(
Log in to post comments)