Re: Wait-free Hazard Pointers Using Std Atomics

Liste des GroupesRevenir à cl c++ 
Sujet : Re: Wait-free Hazard Pointers Using Std Atomics
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : comp.lang.c++
Date : 28. May 2025, 23:34:05
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <101830t$3faku$1@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
On 5/26/2025 2:58 PM, jseigh wrote:
and asymmetric memory barriers of course.
 https://threadnought.wordpress.com/2025/05/26/wait-free-hazard-pointers- using-std-atomics/
 Looks like it runs faster without the conditional branch.
 Not sure it's a new idea.  The only wait-free version of hazard pointers
I've seen so far involves a storage to storage move instruction which
might not be available on all platforms.
 Joe Seigh
Actually wrt:
_______________
hz_ptr.store(INDETERMINATE, std::memory_order_relaxed);
T* local = ptr.load(std::memory_order_relaxed);
hz_ptr.store(local, std::memory_order_relaxed);
_______________
For some damn reason, it kind of reminds me of an older way to use only single word exchange to push into a lock-free stack.
Iirc, something like this pseudo code for push:
_____________
cur->next = WAIT_STATE;
node* prev = exchange(head, cur);
cur->next = prev;
_____________
There is a "window" in there where cur->next will be WAIT_STATE. So, when a thread iterating the list, say after pop all, flush, it can do a couple of spins or do something else during iteration on a cur->next being in WAIT_STATE. It's a way to get exchange on push and pop of a stack.
The window is very small. I am having trouble finding on this group where I posted about it before in a working program...

Date Sujet#  Auteur
26 May 25 * Wait-free Hazard Pointers Using Std Atomics17jseigh
27 May 25 +* Re: Wait-free Hazard Pointers Using Std Atomics2Chris M. Thomasson
27 May 25 i`- Re: Wait-free Hazard Pointers Using Std Atomics1jseigh
28 May 25 +- Re: Wait-free Hazard Pointers Using Std Atomics1jseigh
28 May 25 `* Re: Wait-free Hazard Pointers Using Std Atomics13Chris M. Thomasson
29 May 25  `* Re: Wait-free Hazard Pointers Using Std Atomics12jseigh
1 Jun 25   +- Re: Wait-free Hazard Pointers Using Std Atomics1Chris M. Thomasson
1 Jun 25   `* Re: Wait-free Hazard Pointers Using Std Atomics10Chris M. Thomasson
2 Jun 25    `* Re: Wait-free Hazard Pointers Using Std Atomics9jseigh
3 Jun 25     `* Re: Wait-free Hazard Pointers Using Std Atomics8Chris M. Thomasson
10 Jun 25      +- Re: Wait-free Hazard Pointers Using Std Atomics1Chris M. Thomasson
23 Jun 25      `* Re: Wait-free Hazard Pointers Using Std Atomics6jseigh
27 Jun 25       `* Re: Wait-free Hazard Pointers Using Std Atomics5Chris M. Thomasson
27 Jun 25        `* Re: Wait-free Hazard Pointers Using Std Atomics4jseigh
28 Jun 25         `* Re: Wait-free Hazard Pointers Using Std Atomics3Chris M. Thomasson
29 Jun 25          `* Re: Wait-free Hazard Pointers Using Std Atomics2jseigh
4 Jul22:56           `- Re: Wait-free Hazard Pointers Using Std Atomics1Chris M. Thomasson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal