Monday, December 26, 2022

Digest for comp.lang.c++@googlegroups.com - 2 updates in 1 topic

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Dec 26 01:22PM -0800

Imagine you are on a SPARC in RMO mode, you are programming in assembly
language. What memory barrier instruction is the most efficient _and_
correct for use _after_ using an atomic RMW instruction to take
exclusive access? Think about locking a mutex...
 
A: MEMBAR #LoadLoad
 
B: MEMBAR #LoadStore | #LoadLoad
 
C: MEMBAR #StoreLoad | #LoadLoad
 
D: MEMBAR #StoreLoad | #StoreStore
 
 
What about the membar we have to use before atomically unlocking this mutex?
 
 
A: MEMBAR #LoadLoad
 
B: MEMBAR #StoreLoad | #LoadLoad
 
C: MEMBAR #LoadStore | #StoreStore
 
D: MEMBAR #StoreLoad | #StoreStore
"Alf P. Steinbach" <alf.p.steinbach@gmail.com>: Dec 26 11:17PM +0100

On 26 Dec 2022 22:22, Chris M. Thomasson wrote:
 
> B: MEMBAR #StoreLoad | #LoadLoad
 
> C: MEMBAR #LoadStore | #StoreStore
 
> D: MEMBAR #StoreLoad | #StoreStore
 
I really don't have the foggiest idea, but I wish I had! :-o
 
Google tells me that "RMO mode" is relaxed memory order, and I remember
that's been mentioned in what I've read about C++ threading.
 
I can understand that being relevant, but "a SPARC"?
 
Anyway, best wishes for the coming new year.
 
Hopefully at the end there will be less war, less crisis, everything
better except the climate (which is FUBAR), and with everything better
we can be happy no matter what the climate does. Except my old fav idea
of saving the polar bears by transporting them to Antarctica, because
the penguins -- possible Antarctica food source -- are now an endangered
species. But, better.
 
- Alf
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: