We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

Concurrency Runtime

The Concurrency Runtime for C++ helps you write robust, scalable, and responsive parallel applications. It raises the level of abstraction so that you do not have to manage the infrastructure details that are related to concurrency. You can also use it to specify scheduling policies that meet the quality of service demands of your applications. Use these resources to help you start working with the Concurrency Runtime.

For reference documentation, see Reference (Concurrency Runtime).

Tip Tip

The Concurrency Runtime relies heavily on C++11 features and adopts the more modern C++ style. To learn more, read Welcome Back to C++ (Modern C++).

Overview of the Concurrency Runtime

Teaches why the Concurrency Runtime is important and describes its key features.

Comparing the Concurrency Runtime to Other Concurrency Models

Shows how the Concurrency Runtime compares to other concurrency models, such as the Windows thread pool and OpenMP, so that you can use the concurrency model that best fits your application requirements.

Migrating from OpenMP to the Concurrency Runtime

Compares OpenMP to the Concurrency Runtime and provides examples about how to migrate existing OpenMP code to use the Concurrency Runtime.

Parallel Patterns Library (PPL)

Introduces you to the PPL, which provides parallel loops, tasks, and parallel containers.

Asynchronous Agents Library

Introduces you to how to use asynchronous agents and message passing to easily incorporate dataflow and pipelining tasks in your applications.

Task Scheduler (Concurrency Runtime)

Introduces you to the Task Scheduler, which enables you to fine-tune the performance of your desktop apps that uses the Concurrency Runtime.

Task Parallelism (Concurrency Runtime)

How to: Use parallel_invoke to Write a Parallel Sort Routine

How to: Use parallel_invoke to Execute Parallel Operations

How to: Create a Task that Completes After a Delay

Describes tasks and task groups, which can help you to write asynchronous code and decompose parallel work into smaller pieces.

Walkthrough: Implementing Futures

Demonstrates how to combine Concurrency Runtime features to do something more.

Walkthrough: Removing Work from a User-Interface Thread

Shows how to move the work that is performed by the UI thread in a MFC application to a worker thread.

Best Practices in the Parallel Patterns Library

General Best Practices in the Concurrency Runtime

Provides tips and best practices for working with the PPL.

Parallel Algorithms

How to: Write a parallel_for Loop

How to: Write a parallel_for_each Loop

How to: Perform Map and Reduce Operations in Parallel

Describes parallel_for, parallel_for_each, parallel_invoke, and other parallel algorithms. Use parallel algorithms to solve data parallel problems that involve collections of data.

Parallel Containers and Objects

How to: Use Parallel Containers to Increase Efficiency

How to: Use combinable to Improve Performance

How to: Use combinable to Combine Sets

Describes the combinable class, as well as concurrent_vector, concurrent_queue, concurrent_unordered_map, and other parallel containers. Use parallel containers and objects when you require containers that provide thread-safe access to their elements.

Best Practices in the Parallel Patterns Library

General Best Practices in the Concurrency Runtime

Provides tips and best practices for working with the PPL.

Cancellation in the PPL

Describes the role of cancellation in the PPL, including how to initiate and respond to cancellation requests.

How to: Use Cancellation to Break from a Parallel Loop

How to: Use Exception Handling to Break from a Parallel Loop

Demonstrates two ways to cancel data-parallel work.

Creating Asynchronous Operations in C++ for Windows Store Apps

Describes some of the key points to keep in mind when you use the Concurrency Runtime to produce asynchronous operations in a Windows Store app.

Walkthrough: Connecting Using Tasks and XML HTTP Request (IXHR2)

Shows how to combine PPL tasks with the IXMLHTTPRequest2 and IXMLHTTPRequest2Callback interfaces to send HTTP GET and POST requests to a web service in a Windows Store app.

Windows Store app samples

Contains downloadable code samples and demo apps for Windows 8. The C++ samples use Concurrency Runtime features such as PPL tasks to process data in the background to keep the UX responsive.

Asynchronous Agents

Asynchronous Message Blocks

Message Passing Functions

How to: Implement Various Producer-Consumer Patterns

How to: Provide Work Functions to the call and transformer Classes

How to: Use transformer in a Data Pipeline

How to: Select Among Completed Tasks

How to: Send a Message at a Regular Interval

How to: Use a Message Block Filter

Describes asynchronous agents, message blocks, and message-passing functions, which are the building blocks for performing dataflow operations in the Concurrency Runtime.

Walkthrough: Creating an Agent-Based Application

Walkthrough: Creating a Dataflow Agent

Shows how to create basic agent-based applications.

Walkthrough: Creating an Image-Processing Network

Shows how to create a network of asynchronous message blocks that perform image processing.

Walkthrough: Using join to Prevent Deadlock

Uses the dining philosophers problem to illustrate how to use the Concurrency Runtime to prevent deadlock in your application.

Walkthrough: Creating a Custom Message Block

Shows how to create a custom message block type that orders incoming messages by priority.

Best Practices in the Asynchronous Agents Library

General Best Practices in the Concurrency Runtime

Provides tips and best practices for working with agents.

Exception Handling in the Concurrency Runtime

Describes how to work with exceptions in the Concurrency Runtime.

Parallel Diagnostic Tools (Concurrency Runtime)

Teaches you how to fine-tune your applications and make the most effective use of the Concurrency Runtime.

Parallel Diagnostic Tools (Concurrency Runtime)

Teaches you how to fine-tune your applications and make the most effective use of the Concurrency Runtime.

Scheduler Instances

How to: Manage a Scheduler Instance

Scheduler Policies

How to: Specify Specific Scheduler Policies

How to: Create Agents that Use Specific Scheduler Policies

Shows how to work with manage scheduler instances and scheduler policies. For desktop apps, scheduler policies enable you to associate specific rules with specific types of workloads. For example, you can create one scheduler instance to run some tasks at an elevated thread priority and use the default scheduler to run other tasks at the normal thread priority.

Schedule Groups

How to: Use Schedule Groups to Influence Order of Execution

Demonstrates how to use schedule groups to affinitize, or group, related tasks together. For example, you might require a high degree of locality among related tasks when those tasks benefit from executing on the same processor node.

Lightweight Tasks

Explains how lightweight tasks are useful for creating work that does not require load-balancing or cancellation, and how they are also useful for adapting existing code for use with the Concurrency Runtime.


How to: Use the Context Class to Implement a Cooperative Semaphore

How to: Use Oversubscription to Offset Latency

Describes how to control the behavior of the threads that are managed by the Concurrency Runtime.

Memory Management Functions

How to: Use Alloc and Free to Improve Memory Performance

Describes the memory management functions that the Concurrency Runtime provides to help you allocate and free memory in a concurrent manner.

Async programming patterns and tips in Hilo (Windows Store apps using C++ and XAML)

Learn how we used the Concurrency Runtime to implement asynchronous operations in Hilo, a Windows Store app using C++ and XAML.

Code samples for the Concurrency Runtime and Parallel Pattern Library in Visual Studio 2010

Provides sample applications and utilities that demonstrate the Concurrency Runtime.

Parallel Programming in Native Code blog

Provides additional in-depth blog articles about parallel programming in the Concurrency Runtime.

Parallel Computing in C++ and Native Code forum

Enables you to participate in community discussions about the Concurrency Runtime.

Parallel Programming in the .NET Framework

Teaches you about the parallel programming model that is available in the .NET Framework.