paweł Łukasik wroc.net mail: lukasik.pawel@gmail.com twitter: @pawel_lukasik

Post on 26-Mar-2015

224 Views

Category:

Documents

5 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Aplikacje równoległe są dla każdego Paweł Łukasik

Wroc.NET

mail: lukasik.pawel@gmail.comTwitter: @pawel_lukasik

AGENDA

−Po co nam coś nowego?−ThreadPool w .NET 4−Data parallelism−Task parallelism−Nowe klasy

„zsynchronizowane”−Narzędzia

Po co nam coś nowego?

− Abstrakcja− Spójne API− Uproszczone użycie− Dynamiczne zrównoleglenie− Anulowanie zadań− Stany wątków

A wszystko to tylko w jednym celu….

The purpose of the TPL is to make developers more productive by simplifying the process of adding parallelism and concurrency to applications. The TPL scales the degree of concurrency dynamically to most efficiently use all the processors that are available. In addition, the TPL handles the partitioning of the work, the scheduling of threads on the ThreadPool, cancellation support, state management, and other low-level details. By using TPL, you can maximize the performance of your code while focusing on the work that your program is designed to accomplish. 

ThreadPool – Co nowego?

− Zmiana wewnętrznego działania – mniej blokowania

− Wykradanie zadań (work-stealing)− Szybszy - od 2x (na Dual) do 5,6x (na

Quad)

Global queue

Thread 1 Thread 2

T1 T2 T3

DEMO – Data parallelism

Podsumowanie

− Użycie− ParallelOptions− Anulowanie− Różne strategie wyjścia (tzw. Early

Termination)− Partitioner− Local state

DEMO - Task parallelism

TPL - podsumowanie

− Sposób użycia− TaskCreationOptions (PreferFairness,

AttachToParent, LongRunning)− TaskContinuationOptions (NotOn…,

OnlyOn)− Scheduler− Anulowanie

DEMO - Parallel LINQ

PLINQ - Podsumowanie

− .AsParallel, ParallelEnumerable− WithDegreeOfParallelism− WithExecutionMode− WithMergeOptions− WithCancellation

DEMO – Concurrent classes

Podsumowanie – Concurrent classes− Thread-safe− BlockingCollection− ConcurrentQueue

DEMO – Debugging tools

Debugging Tools - Podsumowanie

− Pozwalają w łatwiejszy sposób przyjrzeć się naszej aplikacji− Śledzenie tasków (Parallel Tasks)− Obrazowanie zależności (Parallel Stacks)− Wydajność (Performance Analysis)

Pytania?

Dziękuję za uwagęPytania?

top related