This chapter provided an overview of the task-based programming model introduced with .NET Framework 4 and improved in .NET Framework 4.5. The chapter introduced some of its classes, structures, and enumerations. In order to help you tackle the multicore revolution, it also explained several related concepts used in basic concurrent and parallel programming designs, including the following key points:
- You have to plan and design with concurrency and parallelism in mind. TPL offers structures that simplify the process of creating code that takes advantage of multicore architectures.
- You don't need to recompile your code in order to take advantage of additional cores. TPL optimizes the parallel loops and the distributions of tasks in underlying threads using load-balancing scheduling according to the available hardware resources at run time.
- You can parallelize existing loops and measure the achieved performance gains.
- You can launch tasks and combine everything you learned so far about lists and arrays to work with multiple tasks and manage their execution.
- Concurrent collections provide a way to update collections in parallel and concurrent tasks without worrying about complex synchronization mechanisms.
- You can transform a LINQ query into PLINQ in order to test the speedup achieved with multicore architectures.
- Backward compatibility is possible with threaded code written in previous versions of Visual Basic and .NET Framework.
The next chapter will dive deep into the ...