Chapter 3. Asynchronous Programming
This chapter deep-dives into the asynchronous and multithreaded programming concepts. We will discuss platform-specific problems and give an in-depth description of how threading scenarios are executed on different platforms. The chapter is divided into following sections:
- Multithreading on Xamarin
- Asynchronous methods
- Parallel execution
- Patterns and best practices
- Background tasks
Multithreading on Xamarin
Xamarin platforms together with Windows Runtime follow the basic principles of a single-threaded apartment model. In this model, in simple terms, a process is assigned a single thread which acts as the main trunk for all the other possible branches to be created from and yield back to.
While developers still have the ability to create and consume multiple threads, in modern applications on Xamarin target platforms, this model has been extended with concurrency implementations that delegate the responsibility of thread management to runtime and allow...