What if all threads read a global variable which was assigned a value by the main() prior to the creation of the threads. Do we need any Mutex for synchronization?
3 Answers
No.
A data race happens when multiple threads access a memory location (through a non-atomic value) and at least one of the accesses is a write and the operations are not ordered.
Since thread creation is a synchronization point, all the accesses after thread creation are ordered after the initial write access, and the later accesses are only reads. So there is no race.