Re:The C11 and C++11 Concurrency Model (2014) [pdf]
by en4bz on Saturday November 28, 2015 @08:22PM
(#10643333)
Relaxed is useful when you need atomicity but not consistency between cores. x86 guarantees that all reads/writes are atomic, i.e. no torn reads/writes but I don't think all architectures have this guarantee.
Also there maybe times in your program where you know that your thread has exclusive access to the variable during a certain segment of the program. During this segment it may be beneficial to do lazy reads/writes then complete the critical section with a release operation.
This is used heavily in single producer single consumer queues.
Also there maybe times in your program where you know that your thread has exclusive access to the variable during a certain segment of the program. During this segment it may be beneficial to do lazy reads/writes then complete the critical section with a release operation.
This is used heavily in single producer single consumer queues.