0% found this document useful (0 votes)
56 views24 pages

Linq Plinq

Tools, programming models and runtimes..NET Framework 4 ThreadPool Task Scheduler Resource Manager Visual C++ 10 task scheduler. Resource manager Concurrency Visualizer Operating System threads. Windows key: managed native tooling UMS Threads an easy change coding walkthrough.

Uploaded by

mvbalamca
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views24 pages

Linq Plinq

Tools, programming models and runtimes..NET Framework 4 ThreadPool Task Scheduler Resource Manager Visual C++ 10 task scheduler. Resource manager Concurrency Visualizer Operating System threads. Windows key: managed native tooling UMS Threads an easy change coding walkthrough.

Uploaded by

mvbalamca
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Lets get started!

>
1. 2. 3.

>
1. 2. 3.

In the words of developers

>

>

>

Tools, programming models and runtimes


Tools Programming Models

Visual Studio IDE

Data Structures

Parallel Debugger Tool Windows

Parallel LINQ Task Parallel Library


Concurrency Runtime

Parallel Pattern Library

Agents Library

Data Structures

.NET Framework 4
ThreadPool
Task Scheduler Resource Manager

Visual C++ 10
Task Scheduler
Resource Manager

Concurrency Visualizer

Operating System

Threads Windows Key:


Managed Native Tooling

UMS Threads

An easy change

>
int[] output = arr .Select(x => Foo(x)) .ToArray();

>
int[] output = arr.AsParallel() .Select(x => Foo(x)) .ToArray();

coding walkthrough

int[] input = ... bool[] output = input.AsParallel() .Select(x => IsPrime(x)) .ToArray();
input: output:

1
6

F F T F T

3
8

2 7

IEnumerable<int> input = Enumerable.Range(1,100); bool[] output = input.AsParallel() .Select(x => IsPrime(x)) .ToArray();

Input Enumerator

output:

...

var q = input.AsParallel() .Select(x => IsPrime(x)); foreach(var x in q) { ... }

Poll

Output Enumerator MoveNext

Input Enumerator

...

var q = input.AsParallel().AsOrdered() .Select(x => IsPrime(x)); foreach(var x in q) { ... }


Output Enumerator

Poll

Input Enumerator

MoveNext

...

int result = input.AsParallel() .Aggregate( 0, (a, e) => a + Foo(e), (a1,a2) => a1 + a2);

res1:
Input Enumerator

res2:

result:

...

resN:

int result = input.AsParallel().AsOrdered() .Where(x => IsPrime(x)) .First();

resultFound:
Input Enumerator

result:

Poll

...

Set

int[] output = input.AsParallel() .Where(x => IsPrime(x)) .GroupBy(x => x % 5) .Select(g => ProcessGroup(g)) .ToArray();

output:
Input Enumerator

...

...

Avoid memory allocations


>
>
>

>
> >

Avoid true and false sharing

>
>

>
> > >
>

Avoid True and False Sharing


Cache

Core 1
Cache

6 7 3 2 5

Memory:

5 7 3 2 5 7 3 2
Invalidate
Cache Cache line

Core 2

Core 3
Cache

5 7 3 2

Core 4

5 7 3 2

Use expensive delegates

> >
>
>
>

>

Write simple PLINQ queries

> > >


src.Select(x => Foo(x)) .TakeWhile(x => Filter(x)) .AsParallel() .Select(x => Bar(x)) .ToArray();

Choose appropriate partitioning


>
> > >

>
> >

>

Use PLINQ with thought and care

> > >

> >

>
>

http://msdn.com/concurrency http://code.msdn.microsoft.com/ParExtSamples http://blogs.msdn.com/pfxteam http://blogs.msdn.com/visualizeparallel http://social.msdn.microsoft.com/Forums/enUS/category/parallelcomputing http://igoro.com/

>
>

>
> >

>
>

>
>

>

>

channel9.msdn.com/learn
Built by Developers for Developers.

2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy