dotnet-techne-csharp-concurrency-patterns

Solid

Use when choosing .NET concurrency patterns for async I/O, queues, pipelines, or thread safety. Keywords: async/await, channels, dataflow, Rx, lock contention, producer consumer, parallel processing.

Data & Documents 12 stars 1 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 85/100

Stars 20%
37
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# .NET Concurrency: Choosing the Right Tool ## When to Use This Skill Use this skill when: - Deciding how to handle concurrent operations in .NET - Evaluating whether to use async/await, Channels, Dataflow, or other abstractions - Tempted to use locks, semaphores, or other synchronization primitives - Need to process streams of data with backpressure, batching, or debouncing - Managing state across multiple concurrent entities ## Reference Files - [advanced-concurrency.md](advanced-concurrency.md): TPL Dataflow, Reactive Extensions, hosted worker state patterns, and async local function patterns ## The Philosophy **Start simple, escalate only when needed.** Most concurrency problems can be solved with `async/await`. Only reach for more sophisticated tools when you have a specific need that async/await can't address cleanly. **Try to avoid shared mutable state.** The best way to handle concurrency is to design it away. Immutable data, message passing, and isolated state (like actors) eliminate entire categories of bugs. **Locks should be the exception, not the rule.** When you can't avoid shared mutable state: 1. **First choice:** Redesign to avoid it (immutability, message passing, single-consumer isolation) 2. **Second choice:** Use `System.Collections.Concurrent` (ConcurrentDictionary, etc.) 3. **Third choice:** Use `Channel<T>` to serialize access through message passing 4. **Last resort:** Use `lock` for simple, short-lived critical sections --- ## Decision Tre...

Details

Author
Metalnib
Repository
Metalnib/dotnet-episteme-skills
Created
6 months ago
Last Updated
2 days ago
Language
C#
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category