Date: Fri, 09 Feb 2001 07:57:50 +1100 From: Peter Jeremy <peter.jeremy@alcatel.com.au> To: Bernd Walter <ticso@cicely5.cicely.de> Cc: freebsd-current@FreeBSD.ORG Subject: Re: atomic_ question Message-ID: <20010209075749.Z90937@gsmx07.alcatel.com.au> In-Reply-To: <20010208182106.B80741@cicely5.cicely.de>; from ticso@cicely5.cicely.de on Thu, Feb 08, 2001 at 06:21:07PM %2B0100 References: <20010208182106.B80741@cicely5.cicely.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2001-Feb-08 18:21:07 +0100, Bernd Walter <ticso@cicely5.cicely.de> wrote: >Are atomic_* implementations allowed to spin/sleep? The atomic_* operations are the primitives used to build all the higher level locking functions. Therefore you are not allowed to sleep. As for spinning: You can't implement them using a `normal' spinlock. Some architectures, eg the Alpha, don't have RMW primitives. The Alpha has load-locked and store-conditional instructions which let you build atomic operations - you need to spin between the load and store if the store fails. The store will only fail if you took an interrupt between the load and store or if another master updated the location between your load and store. Look into /sys/alpha/alpha/atomic.s for code. >The only way to implement them on these platforms is to use a lock. Except that locks are built using the atomic_* functions. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010209075749.Z90937>