Threading - 70-536 Study Guide: Key Terms
Threading in C#
http://www.albahari.com/threading/
C# Programmer’s Reference Threading Tutorial
http://msdn.microsoft.com/en-us/library/aa645740(VS.71).aspx
Summary:
The advantage of threading is the ability to create applications that use more than one thread of execution. For example, a process can have a user interface thread that manages interactions with the user and worker threads that perform other tasks while the user interface thread waits for user input.
Code Example (C#):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | static void Main(string[] args) { ThreadStart starter = new ThreadStart(counting); Thread first = new Thread(starter); Thread second = new Thread(starter); first.Start(); second.Start(); first.Join(); second.Join(); Console.Read(); } static void counting() { for (int i = 1; i <= 10; i++) { Console.WriteLine("Count: {0} - Thread: {1}", i, Thread.CurrentThread.ManagedThreadId); Thread.Sleep(10); } } |
Asynchronous Programming Model – A pattern of working with specific types of .NET classes that use begin/End method pairs to provide asynchronous execution of certain methods.
Thread – A single synchronous line of execution of code.
Mutex - A synchronization primitive that can also be used for interprocess synchronization. Used to synchronize threads.
http://msdn.microsoft.com/en-us/library/system.threading.mutex.aspx
Semaphor - Limits the number of threads that can access a resource or pool of resources concurrently. Used to throttle threads.
http://msdn.microsoft.com/en-us/library/system.threading.semaphore.aspx
Timer – a basic object that will fire off an asynchronous call to a method based on time. There are three Timer classes. System.Threading.Timer, System.Windows.Forms.Timer and the System.Timers.Timer
Windows Kernel Objects – Operating system provided mechanisms that perform cross process synchronization. These include mutexes, semaphores, and events.
Tags: 70-536, study guide, threading







