0

I am trying to implement a lock free data structure for a project I am working on . It is a simulation with many parts in it (1 million > ) and I am trying to make the parts take up as small a size as possible ?

By cost if you could provide more information about memory and performance cost it would be great ?

What are the downsides to using std::atomic ?

nnrales
  • 1,481
  • 1
  • 17
  • 26
  • 3
    Atomic is not guaranteed to be lock-free, you might need to check for that: http://en.cppreference.com/w/cpp/atomic/atomic_is_lock_free – lorro Jun 23 '16 at 18:16
  • 1
    The only `atomic` which is guaranteed to be lock-free on all platforms at all times is `std::atomic_flag` – KABoissonneault Jun 23 '16 at 18:54
  • 1
    Otherwise in C++17 you will be able to check if your implementation of `std::atomic` is always lock-free with `std::atomic::is_always_lock_free`, which is a `constexpr` bool. – KABoissonneault Jun 23 '16 at 18:55

0 Answers0