Re: atomic counter
On 15 Okt., 20:34, Alexander Terekhov wrote:
Pete Becker wrote:
[...]
That's why most programmers should stick to sequentially consistent
program models. They're easier to analyze and easier to get right.
The real world runs on multiprocessors that are NOT sequentially
consistent and programmers should understand memory models in the most
relaxed form as a basic programming skill, I think.
Why should they? It's not like programmers have to implement highly
performant concurrent data structures like queues or hashtables every
day. That's a job for some super smart expert. These low level memory
model aspects are for experts to build nice and easy-to-use libraries
on. As long as programmers have a vague idea of what a data race is,
what they can do to avoid them (amotics, mutexes and locks) and as
long as they can read a library's documentation everything should be
fine. There is no need for average Joe to get dirty with things beyond
sequential consistency. I actually consider myself to be average Joe
w.r.t. this part of the language. But hey, if you want to write an
article about it (like "c++ memory model for dummies") I'm all ears...
Cheers!
SG
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]