Professional Visual Basic® 2010 and .NET 4
by Bill Sheldon, Billy Hollis, Jonathan Marbutt, Gastón C. Hillar, Rob Windsor, Kent Sharkey
Chapter 33. Parallel Programming Using Tasks and Threads
WHAT YOU WILL LEARN IN THIS CHAPTER
Understanding the new task-based programming model and the Task Parallel Library
Launching, controlling, managing, and synchronizing parallel tasks
Refactoring loops to run them in parallel using Parallel.For and Parallel.ForEach
Transforming existing sequential code into parallelized code
Measuring the speed gain and the scalability offered by parallelized code
Working with different degrees of parallelism
Understanding the advantages of working with concurrent collections
Implementing a parallel producer-consumer pattern
Parallelizing LINQ queries using PLINQ
In the last few years, multicore technology has become the mainstream in CPU designs, and microprocessor manufacturers continue to improve their processing power. However, the shift to multicore is an inflexion point for software design philosophy.
This chapter is about the new lightweight concurrency model offered by Visual Basic 2010 with .NET Framework 4 and its related hardware technologies. A comprehensive treatment of the challenges offered by the new multicore designs could easily fill 600 pages or more, so this chapter attempts to strike a reasonable balance between detail and succinctness.
LAUNCHING PARALLEL TASKS
It was really difficult to develop applications capable of taking full advantage of multicore microprocessors working with previous .NET Framework versions. It was necessary to launch, control, manage, and synchronize multiple ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access