title: "Atomically" update an entire array
body: <p>I have a single writer thread and single reader thread to update and process a pool of arrays(references stored in map). The ratio of writes to read is almost 5:1(latency of writes is a concern).</p>
  
  <p>The writer thread needs to update few elements of an array in the pool based on some events. The entire write operation(all elements) needs to be atomic.</p>
  
  <p>I want to ensure that reader thread reads the previous updated array if writer thread is updating it(something like volatile but on entire array rather than individual fields). Basically, I can afford to read stale values but not block.</p>
  
  <p>Also, since the writes are so frequent, it would be really expensive to create new objects or lock the entire array while read/write. </p>
  
  <p>Is there a more efficient data structure that could be used or use cheaper locks ?</p>