Book Image

C# 2008 and 2005 Threaded Programming: Beginner's Guide

By : Gaston C. Hillar
Book Image

C# 2008 and 2005 Threaded Programming: Beginner's Guide

By: Gaston C. Hillar

Overview of this book

<p>Most modern machines have dual core processors. This means that multitasking is built right into your computer's hardware. Using both cores means your applications can process data faster and be more responsive to users. But to fully exploit this in your applications, you need to write multithreading code, which means learning some challenging new concepts.<br /><br />This book will guide you through everything you need to start writing multithreaded C# applications. You will see how to use processes and threads in C#, .NET Framework features for concurrent programming, sharing memory space between threads, and much more. The book is full of practical, interesting examples and working code.<br /><br />This book begins with the fundamental concepts such as processes, threads, mono-processor systems, multi-processor systems. As the book progresses, the readers get a clear understanding of starting, joining, pausing and restarting threads. The readers get a better understanding of the simple techniques associated with parallelism. There are short exercises at the end of every chapter for the readers to perform.<br /><br />The book also includes several practical parallelism algorithms and data structures used for illustration, and best practices and practical topics like debugging and performance.</p>
Table of Contents (19 chapters)
C# 2008 and 2005 Threaded Programming
Credits
About the Author
Acknowledgement
About the Reviewers
Preface
Index

Chapter 6. Understanding Thread Control with Patterns

In order to develop parallel algorithms successfully, without meeting the most difficult problems related to concurrency, we can apply some interesting code patterns that will help us in avoiding mistakes in future multithreaded applications. In this chapter, we will study new ways to keep control over the concurrent threads, and we will go on improving our parallel programming capabilities working with more challenging problems to solve. Reading it and following the exercises we shall:

  • Find out how to apply innovative algorithms to generate portions from a huge piece

  • Learn to create highly independent blocks of code to run in multiple threads avoiding many classic concurrency problems

  • Discover how to use flags in multiple threads

  • Find out how to apply new techniques to have exhaustive control over asynchronous and synchronous execution

  • Learn techniques to use multithreading in non thread-safe components

  • Improve the decoupling of the UI when...