4 ms·
> If enough readers are mutating the same ref counter Well if they were mutating the ref counter I’d call them writers not readers. =P But yes. Many people in
by forrestthewoods 1y ago
> If enough readers are mutating the same ref counter
Well if they were mutating the ref counter I’d call them writers not readers. =P
But yes. Many people incorrectly assume that writing an atomic_int from many threads is super fast. I mean it’s atomic! It couldn’t be a smaller atom of work! Alas this is incredibly incorrect. Even atomic ints can be extremely slow.
- gpderetta 1y agoThey are logically readers, the mutation is an implementation detail.
- senderista 1y agoWhich relates to a fundamental principle of concurrent programming: “(logical) readers shouldn’t (physically) write*”. *to contended shared memory
- gpderetta 1y agoWell yes, hence the fix.