Async/Await Webinar Series: Best Practices
See how to avoid common pitfalls in asynchronous code bases
Daniel Marbach shows how to avoid common pitfalls in asynchronous code bases.
Learn how to:
- Differentiate between IO-bound vs CPU-bound work and how this relates to Threads and Tasks
- Avoid serious production bugs as a result of asynchronous methods returning void
- Opt-out from context capturing when necessary
- Deal with synchronous code in the context of asynchronous code
About the webinar series
The 3-part series explores Async/Await best practices, Task Parallel Library and Message Pumps, how the NServiceBus V6 API update helps to avoid common Async/Await pitfalls and makes your code ready for asynchronous APIs in the cloud.
"Async" and "await" are keywords introduced in C# 5 that make it easier for developers to write asynchronous code. Under the hood the C# compiler transforms `async` methods in such a way that whenever an asynchronous operation is "await"-ed, the current flow of control requests to be resumed when the "await"-ed task completes and immediately returns control to the caller of the "async" method.
"Async" and "await" allow developers to reap the benefits of asynchronous programming and stay as close to the familiar synchronous programming model as possible.
The Task Parallel Library (TPL) is a library in the .NET Framework that allows developers to add concurrency and parallelism to their applications without getting bogged down in low-level implementation details. The TPL automatically handles tasks such as managing the thread pool and adjusting the level of concurrency to best utilize the available hardware resources. The API pushes developers into thinking about high-level concerns such as partitioning work to exploit task and data parallelism inherent in the problem at hand instead of focusing on threads, locks and other concurrency primitives.
Software performance can be improved by avoiding blocking on long-running tasks such as Web requests or database queries. In asynchronous code a thread of execution starts a long-running operation and requests to be notified of its completion. This allows the thread to do other useful work while the long-running task is in progress, thus improving throughput and responsiveness.
Asynchronous programming APIs are often based on callbacks. Unfortunately control flow based on callbacks can quickly lead to code that is difficult to write, understand, and maintain.
OTHER VIDEOS IN THE SERIES
About the host
Daniel Marbach is a Microsoft MVP for systems integration and a Solution Architect at Particular Software.
Sign up now and we'll send you access to all the videos in the Async/Await webinar series.
An email was sent to you with details on accessing the rest of the videos in the series.