Multi Threading programming
what Regular problem face during Multi Threading programming?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Feb 10, 2015, 3:11 AM EST
To avoid the chaos which might otherwise ensue, some method needs to be used to control the order in which the threads access such variables. The commonest method is to use 'locks' i.e. a thread is not allowed to enter code where such variables are accessed until the thread which currently owns the lock has released it. This ensures that only one thread at a time can enter critical sections of code and the others therefore need to be queued until it is their turn to enter it.
The problem can also be avoided altogether by using immutable state i.e. objects which once created can't be changed.