On 8/6/2024 2:29 PM, jseigh wrote:
On 7/29/2024 11:15 AM, jseigh wrote:
There isn't a lot of attribution in open source so you can't tell where something came from or if it was independently developed. I know "split reference counting" is now folklore according to a cppcon talk.
I tried to find that "folklore" comment. I thought it was in the cppcon 2023 talk
'Lock-free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done! by Daniel Anderson'
but I couldn't find it again (it's an hour long talk). I did notice the split reference counting
technique described was slightly different than what I called differential reference counting.
It looks to me like split reference counting as described has an ABA problem.
Or maybe not. I took a quick look at the folly code. You really can't easily read c++ code in that style
so I basically guessed a bit. It would be better described as cached local references, rather than split
reference counting. You increment and decrement the local ref count in the atomic shared pointer and just
update the global ref count if the atomic shared pointer is changed. When the local ref is dropped and
the atomic shared ref is different or the local ref count is zero, the global ref count is decremented instead.
It's all about which cache lines you are hitting and how often. If you have a lot of atomic shared pointers to
an object, then maybe "split" reference counting is better since you are splitting across more cache lines. If
you have just one atomic shared pointer then differential reference counting might be better. At any rate,
reference counting performs rather poorly compared to other methods of deferred reclamation.
Joe Seigh
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)