9 Asynchronous functional programming in F#
This chapter covers
- Making asynchronous computations cooperate
- Implementing asynchronous operations in a functional style
- Extending asynchronous workflow computational expressions
- Taming parallelism with asynchronous operations
- Coordinating cancellation of parallel asynchronous computations
In chapter 8, I introduced asynchronous programming as Task
s executing independently from the main application thread, possibly in a separated environment or across the network on different CPUs. This method leads to parallelism, where applications can perform an inordinately high number of I/O operations on a single-core machine. This is a powerful idea in terms of program execution and data throughput speed, casting away the traditional step-by-step programming approach. Both the F# and C# programming languages provide a slightly different, yet elegant, abstraction for expressing asynchronous computations, making them ideal tools, well suited for modeling real-world problems. In chapter 8, you saw how to use the asynchronous programming model in C#. In this chapter, we look at how to do the same in F#. This chapter helps you understand the performance semantics of the F# asynchronous workflow so you can write efficient and performant programs for processing I/O-bound operations.