atomic reference counting primatives.
John Baldwin
jhb at FreeBSD.org
Fri May 21 07:01:47 PDT 2004
On Thursday 20 May 2004 04:56 pm, Julian Elischer wrote:
> This has been raised before but I've come across uses for it again and
> again so I'm raising it again.
> JHB once posted some atomic referenc counting primatives. (Do you still
> have them John?)
> Alfred once said he had soem somewhere too, and other s have commentted
> on this before, but we still don't seem to have any.
I still have them. Part of the problem is that there are lots of different
reference counts that work in different ways, and if you try to come up with
a single all-singing, all-dancing ref count implementation it will be too
complicated to provide any benefit. What I do think might be useful might be
a simple refcount() API that is useful for objects that are immutable when
the refcount > 1 like ucred and are updated via COW. These type of objects
have a mutex that just protects a refcount and nothing else. Using a single
refcount op for those objects will cut the number of atomic ops in half.
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-arch
mailing list