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

Specializing the algorithms for segmentation with classes


So far, we have been developing applications that split work into multiple independent jobs and created classes to generalize the algorithms for segmentation. We simplified the creation of segmented and parallelized algorithms, generalizing behaviors to simplify our code and to avoid repeating the same code on every new application. However, we did not do that using inheritance, a very powerful object-oriented capability that simplifies code re-use. C# is an object-oriented programming language that supports inheritance and offers many possibilities to specialize behaviors to simplify our code and to avoid some synchronization problems related to parallel programming. How can we use C# object-oriented capabilities to define specific segmented algorithms prepared for running each piece in an independent thread using ParallelAlgorithm and ParallelAlgorithmPiece as the base classes?

The answer is very simple—by using inheritance and...