[quoted text, click to view] "Amir Shitrit" <AmirShitrit@discussions.microsoft.com> wrote
> Is it true that sharing a static field among several threads hinders
> performance?
> If so, why is that?
There's nothing intrinsically wrong with sharing a static field across any
number of threads. Performance will be just fine. Just make sure it's a
readonly field, and you're carefull about startup initialization.
Where you will run into troubles is if this field is read/write. Then you
have all the classic thread locking and synchronization issues to deal with.
You have a choice here of several things to use:
- Locking mechanisms (Montior / ReaderWriter / etc)
- Interlock Access
- Volatile Access to prevent optimizations
--
Chris Mullins, MCSD.Net, MCPD:Enterprise
http://www.coversant.net/blogs/cmullins