Date: Wed, 9 Jun 2004 18:06:42 +0000 From: Bosko Milekic <bmilekic@FreeBSD.org> To: Julian Elischer <julian@elischer.org> Cc: "M. Warner Losh" <imp@bsdimp.com> Subject: Re: cvs commit: src/sys/kern kern_proc.c Message-ID: <20040609180642.GA33304@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
Julian Elischer wrote: >As I've said before and will continue to say.. >"We need a more formal model of dealing with reference counts" > >i.e. > >we should get a set of reference counting primatives and make it WELL >DOCUMENTED as to how they should be used.. > >Referenc counting is something that you can't do "a bit". It's like >being pregnant.. either you ARE reference counting, or you are doing >something else. You can't count just "SOME" of the references.. While this idea is initially appealing, you should be aware that it is not as straight-forward as it sounds. Namely, it is sometimes more advantageous to protect the manipulation of the reference count within a section of code already protected by an appropriate object mutex, and other times (in the absence of a mutex), it might be more advantageous to use atomic ops (no need for a mutex, slightly less costly per-instance). So defining an API that does one OR the other might not always be appropriate. -Bosko
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040609180642.GA33304>