|
The counter (i.e. Counter) will point to a contiguous region of memory containing all of its partitions. It will use rseq to implement increment operations:
- The start (restart) code will use the following to index the array of counters and compute the address for the partition that needs to be updated:
- The identifier of the logical core running the update. This is used to index a lookup table that comes before the counter storage. The following figure is an illustration of the memory layout for an object with 7 counters (yellow boxes) running on a 4 core system.
- The (zero-based) offset assigned to the counter.
- The commit code will perform the requested update (increment or decrement) on the address computed in the previous stage.
It also provides a read API that returns the aggregate of all partitions for the counter. This will be the building block to implement CounterHolder.
|