I have an array of arrays, each "inner" array/outer array element is 256 bits. I also have multiple threads. All but one thread are non-critical and one of the threads is extremely critical, even performing compare_exchange_weak()
is considered too expensive.
The critical thread does not need to write to the array, it just needs to read consistent data. The remaining threads all write to the array.
What is the most optimal technique to avoid locks, to allow the critical thread to proceed? Have a second array and then an atomic pointer, alternating between the two "versions"? Is there a name for this technique I can read-up more on?