YoVDO

Advanced C#: Thread-Safe Data with Concurrent Collections

Offered By: LinkedIn Learning

Tags

C# Courses Data Structures Courses Concurrent Programming Courses Multithreading Courses Thread Safety Courses

Course Description

Overview

Learn how to work with the thread-safe concurrent collections to share data across threads and build scalable applications.

Syllabus

Introduction
  • Thread-safe data with concurrent collections
  • What you should know
  • How to access the sample code on GitHub
1. Defining the Problem
  • Collections and threads
  • Use Queue with single thread
  • Use Queue with multiple threads
  • Debug the Queue multiple-thread problem
2. Deconstruct the .NET Queue Class
  • Re-implement the sample with custom class
  • Examine the ExampleQueue code
3. Using Thread-Safe Code with Standard Collections
  • Rewrite the code to support thread locks
  • Use a lock statement and mutex to make thread-safe
  • Why locking is not a good solution
  • How the concurrent collections are better
4. Overview of Thread-Safe Collections
  • Compare standard and concurrent collections
  • Categories of collections
5. Work with the ConcurrentDictionary Class
  • Create a dictionary
  • Use TryAdd to add an item
  • Use TryRemove to remove an item
  • The GetOrAdd method to get or add an item
6. Updating Data in ConcurrentDictionary
  • Review the updated example application
  • Potential problems with updating an item
  • Use TryUpdate to update dictionary value
  • Use a while loop with TryUpdate
  • Use the AddOrUpdate method
  • Why ICollection and other interfaces are not thread-safe
  • Inspect your APIs for ICollection usage
7. Work with the Producer-Consumer Collections
  • Overview of the producer-consumer collections
  • Work with ConcurrentQueue
  • Work with the ConcurrentStack
  • Work with the ConcurrentBag
8. Using the BlockingCollection
  • Understand the BlockingCollection
  • Use the BlockingCollection with ConcurrentQueue
  • Use the CompleteAdding method
  • Use other collections with BlockingCollection
  • Read items with multiple consumers
  • Create items with multiple producers
Continuing Your Journey
  • Next steps

Taught by

Walt Ritscher

Related Courses

Android-разработка: основы, многопоточность, архитектура
Moscow Institute of Physics and Technology via Coursera
Основы разработки на C++: красный пояс
Moscow Institute of Physics and Technology via Coursera
LAFF-On Programming for High Performance
The University of Texas at Austin via edX
Distributed Programming in Java
Rice University via Coursera
iOS-разработка: Swift, UI и многопоточность
Moscow Institute of Physics and Technology via Coursera