Multithreading – can static arrays be safely accessed from multiple threads?
If each thread guarantees to read / write a specific subset of the array, multiple threads can work on the same (static) array without using key parts, etc?
Edit – this is specific to non reference count types and record / packed record arrays
If so, any precautions?
My intuition is positive, but sometimes it can be an unreliable source of information
Solution
Assumptions:
>You have a single array instance (static or dynamic), and > the elements of the array are pure value types (i.e. do not contain references), and > each thread operates on disjoint sub arrays > anything else in the system will be written to the array while the thread is running
With these conditions, I believe your data structure and thread mode can be met, and all algorithms are thread safe