Async and concurrency

This part of the C# course is about work that does not fit in one thread. async and await come first, with the state machine the compiler writes and the reason a waiting method does not block. Tasks and cancellation, async streams and threads follow, then the ways to share state: lock, Interlocked, semaphores, mutexes, the concurrent collections and channels. Parallel, PLINQ, timers and the async pitfalls close the part.

7.1 async and await the state machine, why await does not block Open 7.2 Task and Task<T> Task.WhenAll, WhenAny, Task.Run, an exception from a task Open 7.3 Cancellation CancellationTokenSource, ThrowIfCancellationRequested, a timeout Open 7.4 Async streams IAsyncEnumerable, await foreach, yield in an async method Open 7.5 Threads and the thread pool Thread, ThreadPool, a background thread Open 7.6 Locks and Interlocked a lost update, lock, Interlocked, CompareExchange and Exchange Open 7.7 SemaphoreSlim and Mutex WaitAsync, a bounded section, a named mutex Open 7.8 Concurrent collections ConcurrentDictionary, ConcurrentQueue, BlockingCollection Open 7.9 Channels Channel<T>, a writer, a reader, a bounded channel Open 7.10 Parallel and PLINQ Parallel.For, Parallel.ForEach, AsParallel Open 7.11 Races and deadlocks a race in the output, a deadlock, how to read both Open 7.12 Timers Timer, PeriodicTimer, a periodic job, disposal Open 7.13 Async pitfalls async void, .Result, ConfigureAwait, sync over async Open

Lessons