A histogram counts how many input values fall into each category, or bin. For [2, 0, 1, 2, 2], the counts are [1, 1, 3]. section 8.5
Figure 8.2 The histogram pattern on a CPU. A single thread T0 reads each element of the data array (length n) one at a time and writes to the corresponding bin in the 256-element hist array. With only one writer, there are no conflicts.

A single CPU thread reads each value and increments its matching bin. With only one writer, updates cannot conflict. section 8.5
Parallel counting adds a coordination problem:
- Multiple threads may update the same bin. Use atomicAdd to protect updates, or let each block build a shared-memory histogram and merge the results. section 8.11
- Counts that vary between runs can signal a race; unusually large or carried-over totals can mean the histogram was not zeroed before launch. section 8.11












