Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch > #116322

Re: ARM CAS vs LL/SC

From jseigh <jseigh_es00@xemaps.com>
Newsgroups comp.arch
Subject Re: ARM CAS vs LL/SC
Date 2026-05-07 17:34 -0400
Organization A noiseless patient Spider
Message-ID <10tj0gt$2dimr$1@dont-email.me> (permalink)
References (4 earlier) <10tegkg$ufqr$1@dont-email.me> <10tel2q$2drd$1@csiph.com> <I5IKR.668972$Zve6.578902@fx18.iad> <10tgfds$1hijd$1@dont-email.me> <10th5na$1o9pi$1@dont-email.me>

Show all headers | View raw


On 5/7/26 00:50, Chris M. Thomasson wrote:
> On 5/6/2026 3:30 PM, jseigh wrote:

>>
>> I was messing about with lock-free queue implementations and realized
>> you can do a Michael-Scott lock-free queue implementation using LL/SC,
>> which is an advantage since you don't need deferred reclamation that
>> CAS implementations require and which can slow things down.
> 
> How? Say using it raw with dynamic nodes. The user deletes a node. How 
> does that work without hitting deleted memory? I know that Microsoft 
> uses SEH in its SLIST impl.
> 

Dequeuing from head is straightforward.  I don't think I need to
describe that.

Enqueuing uses the old Double Tap trick.
1) load locked from tail node next pointer.
2) if null and tail still (double tap) points to node,
    store conditional new node address into the next pointer.

Updating tail by doing a load locked on it,
loading the next pointer from tail node, and
updating tail.

It's ok to access deleted memory and long as you don't
actually use it.  The old lock-free stack using
DCAS did that when unsuccessfully popping the stack.
It may have had an invalid value but the DCAS will fail.

Back to comp.arch | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

ARM CAS vs LL/SC jseigh <jseigh_es00@xemaps.com> - 2026-05-05 17:08 -0400
  Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-05 15:01 -0700
  Re: ARM CAS vs LL/SC scott@slp53.sl.home (Scott Lurndal) - 2026-05-05 22:32 +0000
    Re: ARM CAS vs LL/SC MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-05-06 01:29 +0000
      Re: ARM CAS vs LL/SC scott@slp53.sl.home (Scott Lurndal) - 2026-05-06 02:03 +0000
        Re: ARM CAS vs LL/SC Stephen Fuld <sfuld@alumni.cmu.edu.invalid> - 2026-05-05 21:38 -0700
          Re: ARM CAS vs LL/SC Kevin Bowling <kevin.bowling@kev009.com> - 2026-05-05 22:54 -0700
            Re: ARM CAS vs LL/SC Terje Mathisen <terje.mathisen@tmsw.no> - 2026-05-06 15:40 +0200
              Re: ARM CAS vs LL/SC MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-05-06 18:31 +0000
                Re: ARM CAS vs LL/SC scott@slp53.sl.home (Scott Lurndal) - 2026-05-06 18:54 +0000
                Re: ARM CAS vs LL/SC MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-05-06 19:48 +0000
              Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-08 22:11 -0700
            Re: ARM CAS vs LL/SC scott@slp53.sl.home (Scott Lurndal) - 2026-05-06 14:19 +0000
              Re: ARM CAS vs LL/SC jseigh <jseigh_es00@xemaps.com> - 2026-05-06 18:30 -0400
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-06 21:50 -0700
                Re: ARM CAS vs LL/SC jseigh <jseigh_es00@xemaps.com> - 2026-05-07 17:34 -0400
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-08 13:43 -0700
                Re: ARM CAS vs LL/SC MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-05-08 22:18 +0000
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-08 22:06 -0700
              Re: ARM CAS vs LL/SC Paul Clayton <paaronclayton@gmail.com> - 2026-05-10 20:19 -0400
                Re: ARM CAS vs LL/SC scott@slp53.sl.home (Scott Lurndal) - 2026-05-11 14:38 +0000
                Re: ARM CAS vs LL/SC Paul Clayton <paaronclayton@gmail.com> - 2026-05-13 19:28 -0400
                Re: ARM CAS vs LL/SC MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-05-14 01:48 +0000
                Re: ARM CAS vs LL/SC Paul Clayton <paaronclayton@gmail.com> - 2026-05-20 19:24 -0400
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-14 00:49 -0700
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-14 00:58 -0700
                Re: ARM CAS vs LL/SC Paul Clayton <paaronclayton@gmail.com> - 2026-05-20 19:47 -0400
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-27 14:08 -0700
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-27 14:14 -0700
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-27 14:24 -0700
                Re: ARM CAS vs LL/SC MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-05-28 01:27 +0000
                Re: ARM CAS vs LL/SC Paul Clayton <paaronclayton@gmail.com> - 2026-05-20 19:33 -0400
                Re: ARM CAS vs LL/SC scott@slp53.sl.home (Scott Lurndal) - 2026-05-21 20:17 +0000
                Re: ARM CAS vs LL/SC Paul Clayton <paaronclayton@gmail.com> - 2026-05-24 17:24 -0400
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-26 12:44 -0700
                Re: ARM CAS vs LL/SC MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-05-26 20:58 +0000
                Re: ARM CAS vs LL/SC "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-26 14:00 -0700
                Re: ARM CAS vs LL/SC scott@slp53.sl.home (Scott Lurndal) - 2026-05-27 14:25 +0000
                Re: ARM CAS vs LL/SC MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-05-22 17:38 +0000
                Re: ARM CAS vs LL/SC Paul Clayton <paaronclayton@gmail.com> - 2026-05-24 21:32 -0400
                Re: ARM CAS vs LL/SC scott@slp53.sl.home (Scott Lurndal) - 2026-05-14 15:03 +0000
                Re: ARM CAS vs LL/SC Paul Clayton <paaronclayton@gmail.com> - 2026-05-20 20:04 -0400
                Re: ARM CAS vs LL/SC scott@slp53.sl.home (Scott Lurndal) - 2026-05-21 20:22 +0000
                Re: ARM CAS vs LL/SC Paul Clayton <paaronclayton@gmail.com> - 2026-05-24 23:35 -0400
                Re: ARM CAS vs LL/SC MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-05-22 17:42 +0000

csiph-web