I am trying to implement a grid on the heap which can be modified in different threads with shared memory. I need many concurrent reads, but writes are very sparse and consist of a single variable update.
I currently have this code
Now, currently the array has only 1 dimension and 2 elements. Let’s say I write some macros and create a multidimensional, large array. Would the full array be copied if I read/write the elements? Or would only one element be loaded?
Writing this I realize I could also realize this with message passing, sending the target index and the new value to a single updater thread. Would this be a better design in rust?