<p>I have a basic cs-major understanding of multi-threading but have never had to do anything beyond simple timers in an application. Does anyone know of a good resource that will give me a tour how to work with multi-threaded applications, explaining the basics and maybe posing some of the more difficult stuff?</p>

[{'answer_id': 49872, 'author': 'Gulzar Nazim', 'author_id': 4337, 'author_profile': 'https://Stackoverflow.com/users/4337', 'pm_score': 6, 'selected': True, 'text': '<p>This is a great free resource by Joseph Albahari. <a href="http://www.albahari.com/threading/" rel="noreferrer">Threading in C#</a></p>\n'}, {'answer_id': 49880, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': 3, 'selected': False, 'text': "<p>There are 4 basic ways to synchronize threads in .Net:</p>\n\n<ul>\n<li>BackgroundWorker control</li>\n<li>WaitHandles</li>\n<li>Callback functions</li>\n<li>polling an ASyncResult object</li>\n</ul>\n\n<p>Generally you want to start at the top of that list and work down.  That means first look and see if a backgroundworker control is appropriate to the situation.  However, it pretty much assumes windows forms and that you're only spawning one new thread.</p>\n\n<p>So next try waithandles.  Waithandles are good for coordinating several threads together.   You can kick them all off and wait for them all to finish, or if you want to keep a certain number active you keep waiting for just one and spawning the next when it finishes.  Or maybe you know one thread will finish much sooner, so you can wait for it to finish, do a little bit of work, and then wait for the rest to finish.</p>\n\n<p>Waithandles might seem like a bit much if, say, you're only spawning one additional thread and you don't want to block until it's finished.  Then you might use a callback, so that the function you designate will be called as soon as the thread completes.</p>\n\n<p>Finally, if and only if for some reason none of the above will work you can fall back to polling.</p>\n\n<p>I can think of 5 different ways to get a new thread in .Net, also roughly in order:</p>\n\n<ul>\n<li>OS created, normally as the result of winforms event (including the BackgoundWorker).</li>\n<li>Obj.Begin___()/End____().  Certain CLR classes already have these asynchronous methods defined for you, and obviously you want to use them when they're available.</li>\n<li>ThreadPool.QueueUserWorkItem().  Use this most of the time to create your own threads.</li>\n<li>Delegate.BeginInvoke()/EndInvoke().  You can wrap any method this way.</li>\n<li>Thread.Start().  You <em>could</em> do it this way, but I read something recently (don't have the link now) that if QueueUserWorkItem won't work the delegate method is probably better.</li>\n</ul>\n"}, {'answer_id': 49895, 'author': 'Jason Bunting', 'author_id': 1790, 'author_profile': 'https://Stackoverflow.com/users/1790', 'pm_score': 4, 'selected': False, 'text': '<p>Two great articles:</p>\n\n<blockquote>\n  <p><a href="http://msdn.microsoft.com/en-us/magazine/cc163744.aspx" rel="nofollow noreferrer"><strong>What Every Dev Must Know About Multithreaded Apps</strong></a><br>\n  <a href="http://msdn.microsoft.com/en-us/magazine/cc163715.aspx" rel="nofollow noreferrer"><strong>Understand the Impact of Low-Lock Techniques in Multithreaded Apps</strong></a></p>\n</blockquote>\n\n<p>Although this article isn\'t exactly what you are looking for specifically, it will hopefully be of assistance generally (i.e. it <em>is</em> related, and a very good read):</p>\n\n<blockquote>\n  <p><a href="http://www.gotw.ca/publications/concurrency-ddj.htm" rel="nofollow noreferrer"><strong>The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software</strong></a></p>\n</blockquote>\n'}, {'answer_id': 49902, 'author': 'Pascal', 'author_id': 1311, 'author_profile': 'https://Stackoverflow.com/users/1311', 'pm_score': 2, 'selected': False, 'text': '<p>A good web-resource to learn about multi-threading in .NET:</p>\n\n<ul>\n<li><a href="http://www.yoda.arachsys.com/csharp/threads/index.shtml" rel="nofollow noreferrer">HTML version</a>.</li>\n<li><a href="http://www.yoda.arachsys.com/csharp/threads/printable.shtml" rel="nofollow noreferrer">Printable version</a></li>\n<li><a href="http://www.yoda.arachsys.com/csharp/threads/resources.shtml" rel="nofollow noreferrer">Further resources - (including examples)</a></li>\n</ul>\n'}, {'answer_id': 91292, 'author': 'Dror Helper', 'author_id': 11361, 'author_profile': 'https://Stackoverflow.com/users/11361', 'pm_score': 1, 'selected': False, 'text': '<p>One of the best resources I know on the subject is the "threading in C#" book:\n<a href="http://www.albahari.com/threading/" rel="nofollow noreferrer">http://www.albahari.com/threading/</a></p>\n\n<p>I has a great overview of all a .net developer need to understand in order to program multi threaded applications.</p>\n'}]
['https://Stackoverflow.com/questions/49870', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5056/']