Today's computer runs at more than 2GHz, a blazing speed improvement over just a few years ago. Almost all operating systems today are multitasking, meaning you can run more than one application at the same time. However, if your application is still executing code sequentially, you are not really utilizing the speed advancements of your latest processor. How many times have you seen an unresponsive application come back to life after it has completed a background task such as performing some mathematical calculations or network transfer? To fully utilize the extensive processing power of your computer and write responsive applications, understanding and using threads is important.
A thread is a sequential flow of execution within a program. A program can consist of multiple threads of execution, each capable of independent execution.
This chapter explains how to write multithreaded applications using the
Thread class in the .NET Framework. It shows you how to:
Create a new thread of execution and stop it
Synchronize different threads using the various thread classes available
Write thread-safe Windows applications
BackgroundWorker component in Windows Forms to program background tasks.
Multithreading is one of the most powerful concepts in programming. Using multithreading, you can break a complex task in a single application into multiple threads that execute independently of one another. One particularly good use of multithreading ...