Subject: Re: lock-free data structures
To: None <tech-kern@netbsd.org>
From: Michael van Elst <mlelstv@serpens.de>
List: tech-kern
Date: 01/04/2006 13:55:14
is@NetBSD.org (Ignatios Souvatzis) writes:

>> simply use read-modify-write instructions like BSET/BCLR.

>Yes, but those are functionally like TAS.
>I'm not aware of an atomic CAS equivalent.

True, the closest approximation is probably DEC.B/INC.B.
However, a single bit is sufficient for locking.

>As for CAS - isn't CAS only forbidden in CHIPMEM?

The "forbidden in CHIPMEM" rule applies to the 68000,
it uses a special bus cycle that doesn't fit into
a DMA slot and the result is undefined.

68020 and higher use a dedicated locking signal,
I am not aware of any Amiga hardware that interprets
it and I haven't seen any CPU board that would
synthesize the special 68000 bus cycles for
Zorro-II hardware that might interpret an 68000 TAS.

Things are different for other 68k hardware (e.g.
some VME boards).