Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Oct 2000 11:23:16 -0800 (PST)
From:      Frank Mayhar <frank@exit.com>
To:        John Baldwin <jhb@FreeBSD.ORG>
Cc:        Cedric Berger <cedric@wireless-networks.com>, freebsd-smp@FreeBSD.ORG, Robert Watson <rwatson@FreeBSD.ORG>
Subject:   Re: Reference count invariants in a fine-grained threaded enviro
Message-ID:  <200010311923.e9VJNG309763@realtime.exit.com>
In-Reply-To: <XFMail.001031111514.jhb@FreeBSD.org> from John Baldwin at "Oct 31, 2000 11:15:14 am"

next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin wrote:
> They don't.  The ia64 has a 'fetchadd' instruction, but x86 and alpha don't
> have instructions for this, AFAIK.  You can implement it using the
> atomic_cmpset() functions however.  Of course, what happens if you decrement
> a reference and while you are freeing the object someone else obtains a
> reference to it?  Granted, this shouldn't be possible since if no one can
> get to an object, no one should be able to find the object to allocate a
> reference to it....

This kind of thing is indeed the gotcha.  It takes thinking the problem out
well and careful coding to avoid.  Of course, avoiding a lock where possible
is almost always a win.
-- 
Frank Mayhar frank@exit.com	http://www.exit.com/
Exit Consulting                 http://store.exit.com/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010311923.e9VJNG309763>