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

4ever-clojure
Independent
Algorithms for DNA Sequencing
Johns Hopkins University via Coursera
Advanced Data Structures, RSA and Quantum Algorithms
University of Colorado Boulder via Coursera
Conception et mise en œuvre d'algorithmes.
École Polytechnique via Coursera
مربع الأدوات الخوارزمية
University of California, San Diego via Coursera