csharp-concurrency-patterns

Guide .NET concurrency abstraction selection across async/await, Channels, Akka.NET, Rx, and parallel patterns.

1.1k|101|Updated Nov 12, 2025
One-click install
npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill csharp-concurrency-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-concurrency-patterns
Source: https://github.com/Aaronontheweb/dotnet-skills/tree/main/skills/csharp-concurrency-patterns
Command: npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill csharp-concurrency-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers choose the appropriate concurrency abstraction for .NET tasks, reducing the risk of overuse of locks and ensuring scalable, maintainable code.

Core Features & Use Cases

  • Guided decision framework: compares async/await, Channels, Akka.NET, Reactive Extensions, and parallel patterns so you can select the right tool for the job.
  • Scenario-driven guidance: covers I/O-bound workflows, CPU-bound batch processing, producer/consumer pipelines, stream processing, and stateful entity coordination.
  • Practical tips & anti-patterns: highlights common pitfalls (locks, blocking, shared mutable state) and recommends safer alternatives.

Quick Start

Use this skill to determine the best concurrency primitive for a given task, e.g., "I need to process 100 I/O-bound calls with backpressure, which pattern should I use?"

Frequently Asked Questions about csharp-concurrency-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the best .NET concurrency pattern for handling I/O-bound operations with backpressure?

For I/O-bound operations with backpressure, .NET Channels offer a robust producer/consumer pipeline solution that integrates seamlessly with async/await. This skill helps evaluate this pattern against alternatives to ensure scalable, non-blocking processing.

How do I choose between async/await and Reactive Extensions for stream processing in dotnet?

Choosing between async/await and Reactive Extensions (Rx) for stream processing depends on whether you need pull-based task coordination or push-based event streams. This skill provides decision guidance to compare their tradeoffs and select the correct abstraction for your scenario.

When should I use Akka.NET actors instead of standard parallel patterns for stateful coordination?

Use Akka.NET actors for stateful entity coordination when you need to encapsulate mutable state and message-passing, avoiding shared state locks. This skill outlines when actor-based concurrency is superior to standard parallel patterns for complex state management.

What are common anti-patterns when implementing CPU-bound batch processing in .NET?

Common CPU-bound batch processing anti-patterns include overusing locks, blocking async operations, and relying on shared mutable state. This skill highlights these pitfalls and recommends safer parallel processing alternatives to maintain application throughput.

Does this concurrency decision framework support producer/consumer pipelines using .NET Channels?

Yes, this concurrency decision framework explicitly supports producer/consumer pipelines built with .NET Channels. It evaluates when to apply Channels for I/O-bound workflows and how they compare to other concurrency abstractions for scalable data flow.