5 PLINQ and MapReduce: data parallelism, part 2
This chapter covers
- Using declarative programming semantics
- Isolating and controlling side effects
- Implementing and using a parallel
Reduce
function - Maximizing hardware resource utilization
- Implementing a reusable parallel MapReduce pattern
This chapter presents MapReduce, one of the most widely used functional programming patterns in software engineering. Before delving into MapReduce, we’ll analyze the declarative programming style that the functional paradigm emphasizes and enforces, using PLINQ and the idiomatic F#, PSeq
. Both technologies analyze a query statement at runtime and make the best strategy decision concerning how to execute the query in accordance with available system resources. Consequently, the more CPU power added to the computer, the faster your code will run. Using these strategies, you can develop code ready for next-generation computers. Next, you’ll learn how to implement a parallel Reduce
function in .NET, which you can reuse in your daily work to increase the speed of execution of aggregates functions.
Using FP, you can engage data parallelism in your programs without introducing complexity, compared to conventional programming. FP prefers declarative over procedural semantics to express the intent of a program instead of describing the steps to achieve the task. This declarative programming style simplifies the adoption of parallelism in your code.