From owner-freebsd-current Thu Feb 8 12:58:29 2001 Delivered-To: freebsd-current@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 3F0F837B6D7 for ; Thu, 8 Feb 2001 12:58:10 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id HAA29029; Fri, 9 Feb 2001 07:57:55 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37645) with ESMTP id <01JZWDLDW1IOO2IZIS@cim.alcatel.com.au>; Fri, 9 Feb 2001 07:57:52 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.1/8.11.1) id f18Kvo801356; Fri, 09 Feb 2001 07:57:50 +1100 (EST envelope-from jeremyp) Content-return: prohibited Date: Fri, 09 Feb 2001 07:57:50 +1100 From: Peter Jeremy Subject: Re: atomic_ question In-reply-to: <20010208182106.B80741@cicely5.cicely.de>; from ticso@cicely5.cicely.de on Thu, Feb 08, 2001 at 06:21:07PM +0100 To: Bernd Walter Cc: freebsd-current@FreeBSD.ORG Mail-followup-to: Bernd Walter , freebsd-current@FreeBSD.ORG Message-id: <20010209075749.Z90937@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <20010208182106.B80741@cicely5.cicely.de> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 2001-Feb-08 18:21:07 +0100, Bernd Walter 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