Advanced C#: Thread-Safe Data with Concurrent Collections
Offered By: LinkedIn Learning
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
- Collections and threads
- Use Queue with single thread
- Use Queue with multiple threads
- Debug the Queue multiple-thread problem
- Re-implement the sample with custom class
- Examine the ExampleQueue code
- 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
- Compare standard and concurrent collections
- Categories of collections
- Create a dictionary
- Use TryAdd to add an item
- Use TryRemove to remove an item
- The GetOrAdd method to get or add an item
- 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
- Overview of the producer-consumer collections
- Work with ConcurrentQueue
- Work with the ConcurrentStack
- Work with the ConcurrentBag
- 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
- Next steps
Taught by
Walt Ritscher
Related Courses
Beginning Game Programming with C#University of Colorado System via Coursera Programming with C#
Microsoft via edX DEV206.1x: Introduction to XAML and Application Development
Microsoft via edX Introduction to Game Development
Michigan State University via Coursera Designing Advanced Applications using XAML
Microsoft via edX