Book Image

Mastering C# Concurrency

Book Image

Mastering C# Concurrency

Overview of this book

Starting with the traditional approach to concurrency, you will learn how to write multithreaded concurrent programs and compose ways that won't require locking. You will explore the concepts of parallelism granularity, and fine-grained and coarse-grained parallel tasks by choosing a concurrent program structure and parallelizing the workload optimally. You will also learn how to use task parallel library, cancellations, timeouts, and how to handle errors. You will know how to choose the appropriate data structure for a specific parallel algorithm to achieve scalability and performance. Further, you'll learn about server scalability, asynchronous I/O, and thread pools, and write responsive traditional Windows and Windows Store applications. By the end of the book, you will be able to diagnose and resolve typical problems that could happen in multithreaded applications.
Table of Contents (17 chapters)
Mastering C# Concurrency
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


In this chapter, we have learned about server applications and how they are different. We have looked at scalability and understood why it is very important for a server application to be able to scale well. We have created an OWIN Web API application and learned to host it in an IIS web server and in a separate process. We have used Visual Studio to create load tests for our server application, checked what happens when we use good and poorly written asynchronous code, and leveraged the Apache bench command line tool to run benchmarks without Visual Studio.

We also have reviewed in detail what an I/O thread and an I/O completion port are, and found out reasons why using an asynchronous I/O is the key to building scalable server applications. To check whether a third-party code uses real asynchronous I/O, we have found a tool that shows Win32 API calls. In conclusion, we have learned about synchronization context and how we can configure continuation tasks to be run on a default task...