In today's era of multi-core processors and cloud computing, mastering parallel programming is crucial for developing performant and scalable applications. This hands-on workshop provides you with fundamental knowledge and practical skills to develop modern .NET applications with optimal parallelism. How is "async/await" used correctly? What problems must you watch out for when using threads or tasks? What is the difference between Task and Thread? Why do I get an exception in my application with the information "wrong thread"? How should threads be synchronized? Should async/await also be used in server applications? This workshop answers these critical questions and many more with practical examples and proven solution approaches.
Foundations of Parallel Programming:
- Multithreading overview and architectural principles
- Distinguishing between CPU-bound and I/O bound functionalities
- Performance metrics and profiling techniques
Thread Management and Synchronization:
- Features of the Thread Class and lifecycle management
- Race conditions and deadlocks with threads - detection and prevention
- ThreadPool for automatic management of threads with advantages and limitations
- Synchronization with locks, mutexes, semaphores and monitors
- Unified Cancellation and cooperative cancellation patterns
Task Parallel Library (TPL):
- Tasks compared to threads - when to use what?
- Chaining, continuations and aggregation of tasks
- Exception handling in parallel scenarios
- Parallel Class with data and function parallelization
- Parallelizing in-memory LINQ with Parallel LINQ (PLINQ)
Asynchronous Programming:
- Async Pattern evolution: APM, EAP, TAP
- Event-based Async Pattern (EAP)
- Task-based Async Pattern (TAP) - the modern solution
- Asynchronous programming in Windows applications (WPF, WinUI)
- Asynchronous programming in ASP.NET Core - scalability patterns
Advanced Concepts:
- Timers in .NET - different implementations and use cases
- Synchronized Collections and thread-safe data structures
- Data Flows and pipeline architectures
- Producers and consumers with .NET Channels
- Memory models and cache coherency
Tooling and Best Practices:
- Visual Studio 2022 features for multi-threaded programming
- Debugging and diagnostics for parallel applications
- Performance best practices and anti-patterns
- Testing asynchronous and parallel code