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

The OWIN Web API framework


In this chapter, we will concentrate on the ASP.NET platform. At the time of writing this book, ASP.NET 5 was not released. However, the OWIN project existed, and the code looked almost the same as in ASP.NET 5. So this was used to write the sample server applications. When ASP.NET 5 will be released, it will be easy to convert this code to the new platform. We will not go into the details of OWIN; it is an acronym for Open Web Interface for .NET, and basically, it is a way to compose application components with each other. It is a part of the ASP.NET ecosystem, and all we need to know for now is that with OWIN we can write HTTP services.

When we use ASP.NET, we see a typical HTTP application platform. First, there is an HTTP host that accepts incoming connections from clients. It can be a full Internet Information Services web server, or it can be a simple HTTP listener hosted in a usual .NET process. After the incoming HTTP request is processed by the HTTP host...