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
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++).
Choosing Concurrency Runtime Features
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. |
Compares OpenMP to the Concurrency Runtime and provides examples about how to migrate existing OpenMP code to use the Concurrency Runtime. |
|
Introduces you to the PPL, which provides parallel loops, tasks, and parallel containers. |
|
Introduces you to how to use asynchronous agents and message passing to easily incorporate dataflow and pipelining tasks in your applications. |
|
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 in the PPL
Task Parallelism (Concurrency Runtime) How to: Use parallel_invoke to Write a Parallel Sort Routine |
Describes tasks and task groups, which can help you to write asynchronous code and decompose parallel work into smaller pieces. |
Demonstrates how to combine Concurrency Runtime features to do something more. |
|
Shows how to move the work that is performed by the UI thread in a MFC application to a worker thread. |
|
Provides tips and best practices for working with the PPL. |
Data Parallelism in the PPL
How to: Write a parallel_for Loop |
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 |
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. |
Provides tips and best practices for working with the PPL. |
Canceling Tasks and Parallel Algorithms
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. |
Windows Store Apps
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. |
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. |
|
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. |
Dataflow Programming in the Asynchronous Agents Library
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 |
Describes asynchronous agents, message blocks, and message-passing functions, which are the building blocks for performing dataflow operations in the Concurrency Runtime. |
Shows how to create basic agent-based applications. |
|
Shows how to create a network of asynchronous message blocks that perform image processing. |
|
Uses the dining philosophers problem to illustrate how to use the Concurrency Runtime to prevent deadlock in your application. |
|
Shows how to create a custom message block type that orders incoming messages by priority. |
|
Provides tips and best practices for working with agents. |
Exception Handling and Debugging
Describes how to work with exceptions in the Concurrency Runtime. |
|
Teaches you how to fine-tune your applications and make the most effective use of the Concurrency Runtime. |
Tuning Performance
Teaches you how to fine-tune your applications and make the most effective use of the Concurrency Runtime. |
|
How to: Manage a Scheduler Instance |
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. |
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. |
|
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 |
Describes how to control the behavior of the threads that are managed by the Concurrency Runtime. |
Describes the memory management functions that the Concurrency Runtime provides to help you allocate and free memory in a concurrent manner. |
Additional Resources
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. |
Provides additional in-depth blog articles about parallel programming in the Concurrency Runtime. |
|
Enables you to participate in community discussions about the Concurrency Runtime. |
|
Teaches you about the parallel programming model that is available in the .NET Framework. |