Avoiding Simultaneous Access
Go Up to Coordinating threads Index
To avoid clashing with other threads when accessing global objects or variables, you may need to block the execution of other threads until your thread code has finished an operation. Be careful not to block other execution threads unnecessarily. Doing so can cause performance to degrade seriously and negate most of the advantages of using multiple threads.
The following techniques prevent other threads from accessing the same memory as your thread:
- Locking Objects
- Using Critical Sections
- Using the Multi-read Exclusive-write Synchronizer
- Other Techniques for Sharing Memory