This course is about .NET Parallel Programming with C# and covers the core multithreading facilities in the .NET Framework, namely the Task Parallel Library (TPL) and Parallel LINQ (PLINQ).
This course will teach you about:
This course is about .NET Parallel Programming with C# and covers the core multithreading facilities in the .NET Framework, namely the Task Parallel Library (TPL) and Parallel LINQ (PLINQ).
This course will teach you about:
Task Programming: how to create and run tasks, cancel them, wait on them and handle exceptions that occur in tasks.
Data Sharing and Synchronization, ensuring your access to shared data also happens in a safe and consistent manner.
Concurrent Collections, such as ConcurrentBag, which operate correctly even when accessed from multiple threads.
Task Coordination concepts, including the idea of continuations, as well as uses of synchronization primitives to coordinate tasks.
Parallel Loops which let you easily iterate over a counter or collection while partitioning the data and processing it on separate threads.
Parallel LINQ, the parallel version of .NET's awesome Language-Integrated Query (LINQ) technology.
Async/Await and .NET's support for asynchronous programming.
This course is suitable for:
Beginner and experienced .NET/C# developers
Anyone interested in multi-threading, parallelism and asynchronous programming
The course consists of the following materials:
Video lectures showing hands-on programming
C# files that you can download and run
Before taking the course, you should be comfortable with the C# programming language and familiar with multi-threading.
Some information about the course author, what the course contains, how the material is presented and what you need to know before taking part in the course.
An overview of all the lectures in this section.
An introduction to the Task abstraction, with examples of how to create and start tasks.
A look at .NET's special CancellationTokenSource and CancellationToken classes that are used to cooperatively cancel running tasks.
If you're inside a task and want to wait a while, there are ways to do this besides Thread.Sleep().
How to wait on a single task or, indeed, a set of tasks.
If an exception is thrown inside a Task, who catches it, and how?
A summary of key concepts from this section's lectures.
An overview of the lectures in this section.
The lock keyword and what it means.
Atomic operations on primitive values.
A lock that doesn't yield.
One of the key WaitHandle-based synchronization structures.
A look at reader-writer locks, including upgradeability and recursion support.
A summary of the lectures in this section.
An overview of lectures in this section.
A thread-safe dictionary.
A thread-safe queue.
A thread-safe stack.
A collection which is similar, in principle, to a thread-safe List except it doesn't preserve the order. Thus it's called a Bag.
BlockingCollection is a special wrapper around the producer-consumer collection that is capable of blocking the producer thread until a value is available, and is capable of exposing a 'consuming enumerable' that blocks the consumer until there's an item for it to consume.
A summary of materials from the lectures in this section.
An overview of lectures in this section.
Different forms of continuations exist.
Child tasks are tasks whose lifetime are joined to those of the parent.
A useful sync primitive for coordinating multi-phase algorithms.
A simple sync primitive with a counting-down value.
Ordinary signals which, depending on whether they are set or not, block or unblock a thread.
A complicated sync data structure which allows increasing/decreasing a counter to control how many threads can be executing at the same time.
Parallel loops... what could be simpler?
Learn to break out of or cancel parallel loops, and what happens if an exception is thrown.
Concurrent access from all tasks on each iteration to a variable is very inefficient. Why not access it once per task, and keep a task-local store of intermediate results that incurs no sync overhead?
Creating a delegate on each Task invocation is inefficient, but if we tell .NET how we want to partition data, we may end up with a much faster method.
A summary of materials from the lectures in this section.
AsParallel() turns an IEnumerable<T> into a ParallelQuery<T>
Just like with Task and Parallel.Xxx, PLINQ takes cancellation tokens and throws either AggregateException or OperationCancelledException.
How quickly do you want your data? Or should PLINQ cluster results together and return them in batches?
LINQ Aggregate() function has a special PLINQ overload.
A detailed description of async/await mechanics.
A look at async/await in action... in a WinForms app.
Behind the scenes, async methods get their associated state machines.
Learn what Task.Run is used for.
Learn about Task.WhenAny/WhenAll.
C# doesn't have async constructors (yet), but factory methods are the next best thing.
A generalized way of indicating that your classes require asynchronous initialization.
We all love Lazy<T>, but can it play nice with async methods?
A brand new class introduced in .NET Core, ValueTask is a lightweight alternative to Task.
A summary of all the things we've learned in this section of the course.
Links to my other courses.
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.