Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617Ab0DINLW (ORCPT ); Fri, 9 Apr 2010 09:11:22 -0400 Received: from earthlight.etchedpixels.co.uk ([81.2.110.250]:48316 "EHLO www.etchedpixels.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751743Ab0DINLT (ORCPT ); Fri, 9 Apr 2010 09:11:19 -0400 Date: Fri, 9 Apr 2010 14:15:18 +0100 From: Alan Cox To: Michael Schnell Cc: linux-kernel , nios2-dev Subject: Re: atomic RAM ? Message-ID: <20100409141518.0dbe7050@lxorguk.ukuu.org.uk> In-Reply-To: <4BBF2351.3040506@lumino.de> References: <4BBD86A5.5030109@lumino.de> <20100408114542.47b6589a@lxorguk.ukuu.org.uk> <4BBDC7D4.6040301@lumino.de> <20100408143750.0acebaa1@lxorguk.ukuu.org.uk> <4BBF0784.2060002@lumino.de> <20100409125426.5bc200da@lxorguk.ukuu.org.uk> <4BBF2351.3040506@lumino.de> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 675 Lines: 16 > If you think it could be done with NIOS: using store ordering, how can I > implement a pthread_mutex_..() workalike ? Lamport's Bakery is the classic algorithm for doing this. It has very minimal assumptions about visibility of writes and the order they are seen so should certainly work uniprocessor and may work SMP depending upon the cache coherency rules. It doesn't scale well to large numbers of threads however. Alan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/