linux-mips
[Top] [All Lists]

Re: patches for test-and-set without ll/sc (Re: thread-ready ABIs)

To: Machida Hiroyuki <machida@sm.sony.co.jp>
Subject: Re: patches for test-and-set without ll/sc (Re: thread-ready ABIs)
From: Ralf Baechle <ralf@oss.sgi.com>
Date: Thu, 24 Jan 2002 10:59:15 -0800
Cc: kevink@mips.com, aj@suse.de, hjl@lucon.org, linux-mips@oss.sgi.com
In-reply-to: <20020123145634M.machida@sm.sony.co.jp>; from machida@sm.sony.co.jp on Wed, Jan 23, 2002 at 02:56:34PM +0900
References: <20020122232529V.machida@sm.sony.co.jp> <005301c1a368$87d27ed0$10eca8c0@grendel> <20020123145634M.machida@sm.sony.co.jp>
Sender: owner-linux-mips@oss.sgi.com
User-agent: Mutt/1.2.5i
On Wed, Jan 23, 2002 at 02:56:34PM +0900, Machida Hiroyuki wrote:

> > It should in principle be SMP safe.
> 
> I don't think so.
> 
> Suppose that 
>       THREAD A is bound to CPU A and THREAD B is bound to CPU B.
>       THREAD A and THREAD B are running on_atomic_inc_nollsc(). 
> Two threads are really running at the same time, without
> context-switch. In this case nobody clear k1.

There is a method for mutual exclusion called Dekker's Algorithem (sp?)
which only requires just atomic stores and can be implemented in plain
C.  Downside is it's weak performance that renders it pretty much a CS
only thing.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>