Date: Fri, 21 May 2004 10:02:02 -0400 From: John Baldwin <jhb@FreeBSD.org> To: freebsd-arch@FreeBSD.org Cc: Julian Elischer <julian@elischer.org> Subject: Re: atomic reference counting primatives. Message-ID: <200405211002.02386.jhb@FreeBSD.org> In-Reply-To: <Pine.BSF.4.21.0405201340590.72391-100000@InterJet.elischer.org> References: <Pine.BSF.4.21.0405201340590.72391-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405211002.02386.jhb>