Chapter 15. Threading
A
thread represents a single flow of execution logic in a program. Some
programs never need more than a single thread to execute efficiently,
but many do. Threading in .NET allows you to build responsive and
efficient applications. Many applications need to perform multiple
actions at the same time (like supporting simultaneous user interface
interaction and data processing)—threading allows the developer
to provide this capability. Once you have multiple threads of
execution in your application, you need to start thinking about what
data in your application needs to be protected from multiple access,
what data could cause threads to develop an interdependency that
could lead to deadlocking (where Thread A has a resource that Thread
B is waiting for and Thread B has a resource that Thread A is waiting
for), and how to store data relative to the individual threads. We
will explore some of these issues to help you take advantage of this
wonderful capability of the .NET Framework, while explaining the
areas to beware and items to keep in mind while designing and
creating your multithreaded application.
|