Threads

Applications are sometimes multithreaded. Multithreaded applications are much more susceptible to bugs, including synchronization problems. Each thread represents a separate path of execution and owns resources, such as stack, thread local storage, local variables, and thread environment blocks. Proper use of threads can enhance the performance of an application, whereas poor implementation can hinder performance.

Creating threads is not difficult. Managing threads is the real challenge—at times, it can be like herding cats. Thread synchronization, which is the management of threads, can be complicated, including preventing race conditions and controlling access to shared resources.

Improperly implemented threads can lead to a high-utilization ...

Get Programming Microsoft® Visual C#® 2008: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.