|
From C# Concurrency by Nir Dobovizki This book teaches you to harness the power of multithreading and async/await to get maximum speed from your code. |
If you want to write high performance software you have to make the computer do more then one thing at the same time, there are two ways to do this: multithreading (concurrent programming) and asynchronous programming.
Multithreading is notoriously difficult to get right – but almost every programmer knows the basic of how it works, it is taught in most computer science programs and programming courses. There are numerous books, blogs and on-line tutorials about it (however a large percentage of them are over-simplified or outdated to the point of being misleading).
Asynchronous programming on the other hand, while used in hardware and operating systems since before the original IBM PC and in high performance servers ever since high performance servers existed (and by me personally since the late 90s) – has been practically unknown by most software developers until recently.
Asynchronous programing has been introduced to the common software developer by JavaScript (due to a limitation of web browsers’ rendering engines, not as a way to write high performance software) and was quickly integrated into programming languages with C# leading the way with the async/await keywords that are now adopted into many other programming languages.
Today the C# async/await feature is extremely widely used – however, most software developers do not understand how it works or how to use it correctly – and using it incorrectly is a major reason of low performance and very hard to find bugs.
I work as a consultant and have found myself explaining async/await to multiple development teams at multiple software companies because I found the same bugs again and again – bugs caused by incorrect understanding of how asynchronous programing in general and C#’s async/await in particular work.
About the book
In this book, I will focus on asynchronous programming and the C# async/await feature and explain it in a way that will give the reader a simple mental model of how it works and how to use it correctly. I will also talk about multithreading and how multithreading and asynchronous programming interact with each other.
After reading this book the reader will be able to:
- Understand the difference between multithreading and asynchronous programming as well as understand how they interact.
- Write correct code using C#’s async/await feature
- Debug asynchronous C# code and identify common asynchronous programming bugs
- Identify the common pitfalls of multithreaded code and bypass them
About the reader
The typical reader
I expect the typical reader to be a backend C# developer with 4 years of experience or more, working in a technical leadership role (senior developer, technical lead or software architect).
Prerequisites from the reader
I expect the reader will have knowledge and experience in programming in C# and the knowledge that multithreading and async/await exist.
Ecosystem
Asynchronous programming and async/await in C# is a very popular subject, there is a lot of information available of various quality but it’s very difficult to find good, up-to-date and reliable information.
Official Documentation
Microsoft has official documentation about C# async/await and asynchronous programing. For example:
- Asynchronous programming with async and await (Asynchronous programming in C# | Microsoft Docs)
- Async in depth (Async in depth | Microsoft Docs)
Most of the official documentation, however, confuses multithreading with asynchronous programming (at least in the mind of the reader), does not explain how the system works internally and software developers I work with find it confusing and unhelpful.
This book aims to fill in the gaps and be a go-to resource for C# multithreading and asynchronous programming.
So, if you’re ready to take a deep dive into this particular subject, you can check out the book here.