In the Insights on .NET Concurrency series we covered three main forms of concurrency in that can be used to solve different problems. Each form has its own strengths to solve problems of this complex world. The right tool for the right job. Parallel programming using TPL offers easy way of parallelising operations in order to increase application’s throughput. Asynchronous programming is becoming a functional requirement for modern UI applications. We saw that async/await abstract away a lot of the complexity. Reactive programming using Rx is fit for scenarios when your applications has data sources (streams of data).
mixed form concurrency diagram

Join Forces

A nice way to look at the concurrency forms is that they complement each other. Thanks to the extensiveness of Rx library we can convert a Task into an Observable and utilise Rx capabilities with parallel and asynchronous programming. The same way we joined Parallel and Asynchronous in a previous post, but here we adding Rx.

Below is a method that executes in parallel 3 operations and awaits them asynchronously.

When adding Rx to the mix, that’s what you can achieve:

Leave a Reply

Your email address will not be published. Required fields are marked *