Multithreading In this module I'm going to introduce CLR support for concurrent execution in the. NET framework in the form of multi-threading. To begin, with I'm going to take a look at just a couple of pieces of vocabulary. I'm going to introduce the differences between a process and a thread just so that we all start from the same working definitions. And I'm going to take a look at multi-threading use-cases. Why you would want to go down the road of exploring the use of multiple threads in a. NET application. And then, you can't ever have that discussion without having the corresponding discussion on some of the caveats related to multi-threading. And once we get those out of the way, I'm going to take a look at the mechanics have actually working with the thread or threads in terms-- for starting threads. How you pass information to those threads in terms of arguments and then how you go about coordinating the orderly shutdown of threads once you no longer need them. And then, I'll also finish up with look at some facilities in the CLR and support of multi-threaded execution in the form of the thread pool and we'll take a look at both directly interfacing with the thread pool as well as a brief look at asynchronous delegate in vocation and asynchronous I/O.
Thread Synchronization In this module, I'm going to introduce some of the thread synchronization primitives that are supported by the. NET Framework class library. I will start with a look at really the crux of the issue in terms of program correctness in a multithreaded program. And then we'll take a look at some of the techniques that are available to you as a CLR or. NET programmer, who's dealing with multiple threads of execution in your program. We'll start with a look at basically the simplest of techniques which involves facilities available to you when you want to update machine word-sized values such as integers. Then we'll take a look at a technique that's really an avoidance technique referred to as data partitioning where you divide up the work to be done across multiple threads in a manner that allows those threads to avoid accessing actually the same resources. And then we'll sort of finish with the look at techniques that are suitable when you have a real need to access resources at the same time and you need to wait. And so we'll take a look at the wait-based synchronization primitives that are provided. And I'll mention the existence of a few others that are beyond the scope of this module, but we'll take a look at two in detail. In this talk, actually, this topic leads to one related topic which is deadlock and this is something that can happen when you end up with a possibility, what's referred to as a hold-and-wait scenario. Typically, when you have more than one lock, protecting more than one resource and more than one thread involved, so we'll take a look at that as well.