Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #123838
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: std::atomic work as volatile, or not, I think not... |
| Date | 2026-05-11 13:09 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <10ttd29$1d9tm$1@dont-email.me> (permalink) |
| References | (2 earlier) <10ts3vt$3v1g3$1@dont-email.me> <10ts5ur$updt$2@dont-email.me> <10tscpt$3vdv3$1@dont-email.me> <10tse1h$11bk8$1@dont-email.me> <YSmMR.786564$G7x8.334554@fx15.iad> |
On 5/11/2026 8:48 AM, Scott Lurndal wrote: > David Brown <david.brown@hesbynett.no> writes: >> On 11/05/2026 12:59, boltar@caprica.universe wrote: > >>>> >>>> Atomics are for shared information /without/ needing semaphores, >>> >>> The underlying implementation will be the same. > > That depends entirely on the instruction set of the target > processor. Most of the modern architectures include > instructions to atomically modify a location in memory > (e.g. Fetch-and-add). This is far more efficient > than attempting to acquire a spinlock or posix mutex > simply to update a single location in memory, > particularly when there are a significant number > of contenders (e.g. on a 128-core CPU). > > This is essentially free in systems with > processor memory caching, since only one > processor (hardware thread) can own a cache line for write > access at any point in time. The processor > simply sends the atomic op directly to the cache > (or if caches are bypassed, the memory controller) > for execution. > > Those operations have been extended such that > modern hardware supports that level of atomicity > across PCI express and other interconnect > technologies. > > The advantage of the cache coherency algorithm > efficiency vs LL/SC or LDEX/STREX is very signficiant. > > ARM, for example, has atomic: > > - load and add (LDADD) > - load and exclusive or (LDEOR) > - load and clear bit (LDCLR) > - load and set bit (LDSET) > - load and return minimum value > - load and return maximum value Is neat that ARM supports LL/SC _and_ the atomic RMW's.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
std::atomic work as volatile, or not, I think not... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-10 21:51 -0700
Re: std::atomic work as volatile, or not, I think not... David Brown <david.brown@hesbynett.no> - 2026-05-11 08:25 +0200
Re: std::atomic work as volatile, or not, I think not... boltar@caprica.universe - 2026-05-11 08:28 +0000
Re: std::atomic work as volatile, or not, I think not... David Brown <david.brown@hesbynett.no> - 2026-05-11 11:02 +0200
Re: std::atomic work as volatile, or not, I think not... boltar@caprica.universe - 2026-05-11 10:59 +0000
Re: std::atomic work as volatile, or not, I think not... David Brown <david.brown@hesbynett.no> - 2026-05-11 13:20 +0200
Re: std::atomic work as volatile, or not, I think not... Bonita Montero <Bonita.Montero@gmail.com> - 2026-05-11 13:22 +0200
Re: std::atomic work as volatile, or not, I think not... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-11 13:00 -0700
Re: std::atomic work as volatile, or not, I think not... boltar@caprica.universe - 2026-05-11 15:08 +0000
Re: std::atomic work as volatile, or not, I think not... David Brown <david.brown@hesbynett.no> - 2026-05-11 22:19 +0200
Re: std::atomic work as volatile, or not, I think not... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-11 13:25 -0700
Re: std::atomic work as volatile, or not, I think not... scott@slp53.sl.home (Scott Lurndal) - 2026-05-11 15:48 +0000
Re: std::atomic work as volatile, or not, I think not... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-11 13:09 -0700
Re: std::atomic work as volatile, or not, I think not... Bonita Montero <Bonita.Montero@gmail.com> - 2026-05-11 13:21 +0200
Re: std::atomic work as volatile, or not, I think not... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-11 12:48 -0700
Re: std::atomic work as volatile, or not, I think not... red floyd <no.spam.here@its.invalid> - 2026-05-11 21:04 -0700
Re: std::atomic work as volatile, or not, I think not... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-14 00:35 -0700
Re: std::atomic work as volatile, or not, I think not... cross@spitfire.i.gajendra.net (Dan Cross) - 2026-05-11 11:53 +0000
Re: std::atomic work as volatile, or not, I think not... David Brown <david.brown@hesbynett.no> - 2026-05-11 15:18 +0200
Re: std::atomic work as volatile, or not, I think not... Bonita Montero <Bonita.Montero@gmail.com> - 2026-05-11 15:20 +0200
Re: std::atomic work as volatile, or not, I think not... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-11 12:54 -0700
Re: std::atomic work as volatile, or not, I think not... "Fred. Zwarts" <F.Zwarts@HetNet.nl> - 2026-05-11 11:46 +0200
Re: std::atomic work as volatile, or not, I think not... David Brown <david.brown@hesbynett.no> - 2026-05-11 12:40 +0200
Re: std::atomic work as volatile, or not, I think not... Chris Ahlstrom <OFeem1987@teleworm.us> - 2026-05-11 06:55 -0400
Re: std::atomic work as volatile, or not, I think not... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-12 12:14 -0700
Re: std::atomic work as volatile, or not, I think not... scott@slp53.sl.home (Scott Lurndal) - 2026-05-11 15:49 +0000
Re: std::atomic work as volatile, or not, I think not... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-05-11 12:36 -0700
csiph-web