The Concurrency Runtime is divided into four components: the Parallel Patterns Library (PPL), the Asynchronous Agents Library, the Task Scheduler, and the Resource Manager. These components reside between the operating system and applications. The following illustration shows how the Concurrency Runtime components interact among the operating system and applications:
Concurrency Runtime Architecture
The Concurrency Runtime is highly composable, that is, you can combine existing functionality to do more. The Concurrency Runtime composes many features, such as parallel algorithms, from lower-level components.
The following sections provide a brief overview of what each component provides and when to use it.
Parallel Patterns Library
The Parallel Patterns Library (PPL) provides general-purpose containers and algorithms for performing fine-grained parallelism. The PPL enables imperative data parallelism by providing parallel algorithms that distribute computations on collections or on sets of data across computing resources. It also enables task parallelism by providing task objects that distribute multiple independent operations across computing resources.
Use the Parallel Patterns Library when you have a local computation that can benefit from parallel execution. For example, you can use the parallel_for algorithm to transform an existing for loop to act in parallel.
For more information about the Parallel Patterns Library, see Parallel Patterns Library (PPL).
Asynchronous Agents Library
The Asynchronous Agents Library (or just Agents Library) provides both an actor-based programming model and message passing interfaces for coarse-grained dataflow and pipelining tasks. Asynchronous agents enable you to make productive use of latency by performing work as other components wait for data.
Use the Agents Library when you have multiple entities that communicate with each other asynchronously. For example, you can create an agent that reads data from a file or network connection and then uses the message passing interfaces to send that data to another agent.
For more information about the Agents Library, see Asynchronous Agents Library.
Task Scheduler
The Task Scheduler schedules and coordinates tasks at run time. The Task Scheduler is cooperative and uses a work-stealing algorithm to achieve maximum usage of processing resources.
The Concurrency Runtime provides a default scheduler so that you do not have to manage infrastructure details. However, to meet the quality needs of your application, you can also provide your own scheduling policy or associate specific schedulers with specific tasks.
For more information about the Task Scheduler, see Task Scheduler (Concurrency Runtime).
Resource Manager
The role of the Resource Manager is to manage computing resources, such as processors and memory. The Resource Manager responds to workloads as they change at run time by assigning resources to where they can be most effective.
The Resource Manager serves as an abstraction over computing resources and primarily interacts with the Task Scheduler. However, you can use the Resource Manager to integrate the computing resource management of the Concurrency Runtime with your own concurrency library. You can also use the Resource Manager to fine-tune the performance of the Concurrency Runtime with your applications.