Suppose the size of these containers are fixed. The array, vector and unordered_map are fully initialized with all indexes/keys possible in our setting before concurrent use.
Then in the concurrent step, only operations allowed are read and update. No delete or add are allowed. So no resize nor rehash would happen (I think).
Under this scenario, are these containers thread-safe? Any example they would break?
I have read some questions like 1 and 2 that make me believe they would be thread-safe if each thread writes to a distinct element. 3 says STL containers are only thread-safe when one thread is writing at a time and no other is reading. I am having a hard time understanding why multiple threads update a same element is not safe? As long as the memory is aligned (no weird partial results), it's just last write wins right?