Back in August 2005 I wrote a MSDN article entitled What Every Dev Must Know About Multithreaded Apps, in which I describe the fundamentals of multi-threaded programming. Although it was written over 10 years ago now, frankly, it is just as correct and relevant today.
I discovered, however that the link to this article is now much more difficult to access. MSDN articles over 8 years old are not directly accessible but you have to download the whole issue as a CHM file, remove the ‘blocking’ bit, and then extract the file. Not super-hard, but not easy either. To fix this I have done that for you and attached the resulting PDF file to this blog post. Now you can simply open it to see this article.
To entice you to do just his, I will say that anyone who has to write ANY code that contains multiple threads needs to understand the content in this article. Typically developer’s start out thinking multi-threaded programming is ‘easy’ (after all it is ‘just’ running multiple sequential programs in parallel). Then the find out just how difficult it is to insure that their programs run correctly in such an environment, and believe it is practically impossible. Finally, after reading something like the article below they reach ‘maturity’ on the subject and realize it CAN be very dangerous but if you follow a set of simple rules CONSISTANTLY, you can do it reliably. This article tries to get you to this mature state as quickly as possible.