Chapter 4. Asynchronous Programming

This chapter will dive into the asynchronous elaboration techniques available within the .NET framework.

Here we will explain the following features, techniques, and frameworks:

  • Asynchronous programming theory
  • Asynchronous Programming Model (APM)
  • Event-based Asynchronous Pattern (EAP)
  • Task-based Asynchronous Pattern (TAP)
  • Async/await operator
  • Task optimization and CLR tuning
  • Task tweaking
  • Task UI synchronization

Understanding asynchronous programming

Multi-threaded programming happens when we use multiple threads to execute our code. The added benefit is the increased CPU power available by using multiple threads.

Asynchronous programming happens anytime we move the execution of any our code from the main thread to another one and then back to the first one to catch any result or acknowledgement. Thus, the difference between multi-threaded and asynchronous programming is that the catching of the result happens within the asynchronous one. Otherwise, it's called multi-threaded programming. For instance, a background thread providing some data in a polling way is simply another multi-threaded one.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.135.175