Date: Tue, 12 Dec 2000 19:19:17 -0800 From: Mike Smith <msmith@freebsd.org> To: Bosko Milekic <bmilekic@technokratis.com> Cc: Jason Evans <jasone@canonware.com>, John Baldwin <jhb@FreeBSD.ORG>, arch@FreeBSD.ORG Subject: Re: An opaque refcount type Message-ID: <200012130319.eBD3JH306370@mass.osd.bsdi.com> In-Reply-To: Your message of "Tue, 12 Dec 2000 22:05:00 EST." <Pine.BSF.4.21.0012122152030.23594-100000@jehovah.technokratis.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> > Okay, now that I've gotten somewhat in touch with how the implementation > is suggested, I have to bring up the following point, especially since > I feel it highlites an important point that Jason brings up below: > > Having a mutex accompany a ref. counter is really not a good idea. In > the problematic case outlined earlier regarding the mbuf ref. scheme, > you'll note that there is a reference counter accompanying EVERY SINGLE > ext buf. If you now throw in an extra mutex in there, you'll looking at > AT LEAST (NMBCLUSTERS * sizeof(mutex)) added wastage. And that's a lower > bound because it only covers clusters. Not to mention that all these > counters are pre-allocated, pre-wired. The BSD/OS folks use a neat technique where you have a small group of mutexes against which you hash a unique identifier for your object; eg. the address of the refcounter. This avoids the 1:1 noise, but still gives you a good chance of not blocking everything just because you're hitting a refcounter somewhere. -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012130319.eBD3JH306370>