Parallel Programming and TPL Dataflow
-
Upload
khangminh22 -
Category
Documents
-
view
8 -
download
0
Transcript of Parallel Programming and TPL Dataflow
www.sela.co.il 03-6176066
Parallel Programming and TPLDataflow DNParallel - Version: 3
4 days Course
Description: In this course, you will learn how to use the new .NET 4+ features to parallelizeexisting code, to utilize data parallelism, to create and manage tasks, and tosynchronize access to data using concurrent collections.You will gain deeper understanding on Task, Async/Await, TPL Dataflow.The course will discuss best practice, api design and guidelines.
Intended audience: .NET developers with at least 1 year of C# programming experience. Cursoryfamiliarity with operating system concepts such as multithreading and synchronizationis recommended.
Prerequisites: Objectives:
You will gain deeper understanding on Task, Async/Await, Tpl Dataflow.The course will discuss best practice, api design and guidelinesUnderstand TPL Dataflow blocks and performance tuning
Topics:
Parallel from start
www.sela.co.il 03-6176066
• Intoduction º History º Why Do We Need Parallelism? º Threads º The Downside of Parallelism º .NET 1 º Thread º The ThreadPool º Thread vs Thread Pool
• Sync º Amdahl’s Law º How to Parallelize a Unit of Work? º Stack and Heap º Thread safety º Critical Sections (Lock) º Lock vs. Interlocked º CountdownEvent º Quiz
• Collections º Concurrent Collections º ConcurrentQueue<T> º ConcurrentStack<T> º ConcurrentBag<T> º IProducerConsumerCollection<T> º BlockingCollection<T> º ConcurrentDictionary º Other APIs
• Task º Explicit Parallelism º Task == Data Structure º Task<T> º Task as data structure º Semantical Task º Scheduling Task using Factory º Long-Running Tasks º Thread Safety
• Continuation
www.sela.co.il 03-6176066
º A better callback API º Tasks vs. APM º Continuations º WhenAll, WhenAny º Conditional Continuations º Continuation Configurations
• Async º Is it the best we can do? º C# 5: async syntax º Chaining await º Simultaneous await º When All º Using
• Loops º Implicit Parallelism º Async Loop Strategies º Await loop º Await LINQ Pattern
• IOCP º IO operations º Service call without IOCP º IOCP º Async Download º TAP: adoption º Task base WCF proxy / server side �by default º Task base Web API
• Diagnostic º Debugger Parallel Watch window º Parallel Stacks
• Exceptions º Handling Exception º Exception flow control º AggregateException º Catching aggregate exceptions º Read-able exceptions
• Cancellation º Cancellation
www.sela.co.il 03-6176066
º Polling for Cancellation º Cancellation and Tasks º Timeouts and Cancellation
• Summary
TPL Dataflow • What is TPL Dataflow?
º The agent base concept º Evolution º Goals
• Getting started º Namespace º NuGet
• Contract º Source API º Target API º Block API º Push vs. Pool
• Blocks º Blocks categories
• Action block º Structure º Functionality º Throttling
• Buffer Block º Structure º Functionality º Push and Pool º Bounded capacity
• Broadcast Block º Structure º functionality º What makes it different than Buffer Block?
• Transform Block º Structure
www.sela.co.il 03-6176066
º Functionality • Transform Many Block
º Structure º Functionality
• TPL Dataflow and Async º Using async / await with TDF º Processing I/O operations
• Performance tuning º MaxMessagesPerTask
• Case Study: Web Crawler • Appendixs:
º Batch Block º Join Block º Greediness º Greediness and built-in blocks º BatchedJoinBlock º WriteOnceBlock º Rx vs. TDF
• Summary