Sujet : Re: Futex Stack Test...
De : jseigh_es00 (at) *nospam* xemaps.com (jseigh)
Groupes : comp.lang.c++Date : 08. May 2025, 23:46:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vvjc8o$27602$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla Thunderbird
On 5/3/25 21:57, Chris M. Thomasson wrote:
On 5/3/2025 12:58 PM, Chris M. Thomasson wrote:
On 5/3/2025 11:19 AM, Bonita Montero wrote:
Am 03.05.2025 um 20:02 schrieb Chris M. Thomasson:
>
Now, its fun to be able to get a lock-free stack with only single word exchange and cas, and have the ability to use it with a futex to allow one to wait on empty conditions.
>
Is a lock-free stack with a single word CAS really possible without an
ABA-problem ?
>
Will get back to you. Need to run a bunch of errands. If you omit single item pop, yup. It's also possible to get rid of the cas in push.
The ABA problem _and_ memory issue is only there in on the single node pop for a lock-free stack. If you just whack it with a nullptr aka flush _all_ nodes, then you are all right and ready to roll.
Actually, IBM had/has a nice write up of it in an appendix for the principles of operations iirc. I think it might of been in appendix 40 ish or something. God it's been a while since I read that Bonita. Then they have a rather nifty PLO, or perform locked operation, again iirc...
The futex is fun to use because it allows one to wait on an empty condition...
Actually, I remember Joe Seigh taking all the nodes in an exchange, reversing them, and BAM, its FIFO. ;^)
Probably for a MPSC queue. I don't the FIFO semantics would hold up
very well for MPMC queue.
Joe Seigh