Вы находитесь на странице: 1из 3

MGB 2005

1/22/2012 2:37 PM

Visual Studio 2010 Concurrency Runtime


Dana Groff and Rick Molloy Program Managers Parallel Computing Microsoft

Caveats
This is a C++ talk
Visual Studio 2010 on Windows Xbox availability is undetermined

Agenda
Define (15 minutes)
Concurrency Runtime Architecture Concepts

We will briefly cover the concepts Dive into applying those concepts

Demonstrate (30 minutes) Review (5 minutes)

Why?
Productivity:
Make it easier to express parallelism Make it easier to debug parallel code Reduce the likelihood of making errors

Concurrency for C++


Tools
Visual Studio 2010

Native Libraries

Parallel Debugger Profiler Concurrency Analysis

Performance:
Reduce runtime overhead to enable fine-grained parallelism Scale on any hardware platform without explicitly coding to the platform

Data Structures

Parallel Pattern Library

Asynchronous Agents Library

Task Scheduler Resource Manager


Native Concurrency Runtime Windows

UMS Threads

Threads

Key: Key :

V isual Studio 2010

W indow s 7

2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

MGB 2005

1/22/2012 2:37 PM

Concurrency Runtime Concepts


Schedulers
Policy based characteristics Multiple schedulers Work stealing task scheduling

Parallel Pattern & Containers Concepts


Task
A computation that may be internally decomposed into additional tasks

Cooperative Blocking
Use runtime awareness of blocking events to switch to new work on a hardware thread

Task group
A collection of tasks that form a logical computation or subcomputation Wait together or cancel together

Dynamic Resource Management


Arbitrate competing requests for processor resources at runtime Dynamically reallocate resources based on load

Platform Scalability
Map expressed parallelism onto the platforms available parallelism Low overhead allowing for decomposition to small tasks

Parallel Loops
STL style algorithms with support for cancellation and composition

Concurrent Containers
Containers that safely manage concurrent use

Asynchronous Agents Concepts


Agent
A coarse-grained application component designed for larger computing tasks

Message Blocks
Thread-safe containers Participants in message-passing May be source, target, or both

Demo
Scaling up your game for the modern world

Send and Receive


Utility functions in the agents library which facilitate message passing and leverage the cooperative Concurrency Runtime

Control Flow
Runtime connection of sources to targets allows efficient pipeline execution Conditionally accept, filter, and join messages

Review
Scale Computation
Parallel Patterns Minimal code changes Recursion without thread explosion Simplify decomposition

Parallel Pattern Library & Containers


Use the Actor Pattern
Agents contain long-lifespan work Thread safe interfaces by default Provides a mental model for concurrency Easy extensibility

Task Parallelism
task_handle task_group structured_task_group

Parallel Algorithms
parallel_for parallel_for_each parallel_invoke

Coordinate State
Coordinate shared-state with message passing Keep state in the actor instead of globally or through TLS Dont limit your imagination on what you can pass as a message

Synchronization Primitives
reader_writer critical_section event

Concurrent Containers
concurrent_queue concurrent_vector combinable <T>

2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

MGB 2005

1/22/2012 2:37 PM

Asynchronous Agents Library


Message Blocks
unbounded_buffer<T> overwrite_buffer<T> single_assignment<T>

Sample Pack
http://code.msdn.microsoft.com/concrtextras http://code.msdn.microsoft.com/concrtextras
Agents Extras
priority_buffer bounded_buffer alternator join_transform

Pipelining tasks
transformer<T,U> call<T>

PPL Extras
parallel_all_of, parallel_any_of, parrallel_none_of parallel_for_fixed, parallel_for_each_fixed parallel_accumulate, parallel_transform parallel_partial_sum, parallel_partial_sum_fixed

Message Control
choice join

Message Passing
send() / asend() receive()
co-operatively block if needed

Helper Functions
task_scheduler, schedule_group scoped_oversubcription_token countdown_event Barrier

Coming Soon
concurrent_unordered_map concurrent_unordered_set concurrent_hash parallel_sort,connect More demos

Summary
Use Concurrency Runtime so you can focus on scaling your algorithms and not the plumbing Start thinking with parallel patterns
Agents, message blocks, and controls allow you to naturally express data flow that avoids shared state Loops and searches may be good candidates for parallelization
www.microsoftgamefest.com

2009-2010 Micr osoft Cor por ation. All r ights r eserved.


This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Вам также может понравиться