Question: Consider a data structure like a 1 D array that is being written and read by multiple threads at the same time. Should this data
Consider a data structure like a D array that is being written and read by multiple threads at
the same time. Should this data structure be guarded by a mutex?
Yesit will cause the program to use less memory.
Yes it prevents race conditions from occurring when multiple threads use the same index.
No it will only slow down the program.
No if there is only one array, the OS will only allow one thread to write to it anyway.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
