Parallel Extensions: Building multicore applications with. Net

Source: Internet
Author: User

Modern computers have made a worldwide breakthrough in the number of processors and kernels available for use in the system. System developers can leverage these powerful features in their software in a variety of ways, especially when dealing with complex algorithms or large datasets.

Microsoft's Parallel Computing platform (Parallel Computing Platform, PCP) provides tools that enable developers to leverage this powerful feature in an efficient, maintainable, and scalable manner. Parallel extensions introduce important concepts in the. NET Framework toolset: Task Parallel libraries (Tasks Parallel Library, TPL), and Parallel LINQ (Parallel LINQ, PLINQ) provide a parallel mechanism for command and task, allowing developers A declarative approach to data parallelism is used.

Goal

In this hands-on experiment, you will learn how to:

Parallelization of existing algorithms is achieved by using the Parallel helper class and by automatically handling concurrent expressions.

Create and run a task that can be canceled during run.

Use the Task<t> class to create and run a task that returns a value.

Use Parallel LINQ (PLINQ) to optimize LINQ queries for execution in a parallel environment.

System Requirements

You must have the following content to complete this experiment:

Microsoft Visual Studio Beta 2

. Net Framework 4

Installation

Use Configuration Wizard to validate all prerequisites for this experiment. To ensure that all content is configured correctly, follow these steps.

Note: To perform the installation steps, you need administrator privileges to run the script in the Command Line window.

1. If not previously executed, run training Kit's Configuration Wizard. To do this, run the Checkdependencies.cmd script that is located under the%trainingkitinstallationfolder%\labs\introtowf\setup folder. Install the software that is not installed in the prerequisites (please rescan if necessary) and complete the wizard.

Note: For convenience, many of the code that is managed in this experiment can be used in Visual Studio code Snippets. The Checkdependencies.cmd file launches the Visual Studio installer file to install the code fragment.

Practice

This hands-on experiment consists of the following exercises:

Use static Parallel classes to parallelization existing algorithms.

Create and run a parallelization task.

Use the Task<t> class to create and run a task that returns a value.

Use PLINQ to parallel LINQ queries.

Estimated time to complete this experiment: 60 minutes.

Next:

Exercise 1: Use static Parallel helper classes parallelization existing algorithms

Exercise 1: Use static Parallel helper classes parallelization existing algorithms

In this exercise, you'll learn how to use static Parallel helper classes to parallelization existing algorithms. This allows us to replace the for () with Parallel.For ().

Note: To verify that each step is executed correctly, it is recommended that you build the solution at the end of each task.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.