processing-parallel-tasks

Solid

Implements parallel processing using Parallel, PLINQ, and ConcurrentCollections in .NET. Use when processing CPU-bound tasks in parallel or improving multi-core utilization.

Data & Documents 40 stars 6 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 78/100

Stars 20%
54
Recency 20%
100
Frontmatter 20%
40
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# .NET Parallel Processing A guide for APIs and patterns for parallel processing of CPU-bound tasks. **Quick Reference:** See [QUICKREF.md](QUICKREF.md) for essential patterns at a glance. ## 1. Core APIs | API | Purpose | |-----|---------| | `Parallel.For`, `Parallel.ForEach` | CPU-bound parallel processing | | `PLINQ (.AsParallel())` | LINQ query parallelization | | `Partitioner<T>` | Large data partitioning | | `ConcurrentDictionary<K,V>` | Thread-safe dictionary | --- ## 2. Parallel Class ### 2.1 Parallel.ForEach ```csharp public sealed class ImageProcessor { public void ProcessImages(IEnumerable<string> imagePaths) { var options = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }; Parallel.ForEach(imagePaths, options, path => { ProcessImage(path); }); } } ``` ### 2.2 Early Termination ```csharp Parallel.For(0, data.Length, (i, state) => { if (data[i] == target) { state.Break(); } }); ``` --- ## 3. PLINQ ```csharp var results = data .AsParallel() .WithDegreeOfParallelism(Environment.ProcessorCount) .Where(d => d.IsValid) .Select(d => Transform(d)) .ToList(); // When order preservation is needed var results = data .AsParallel() .AsOrdered() .Select(d => Process(d)) .ToList(); ``` --- ## 4. Thread-Safe Collections | Collection | Purpose | |------------|---------| | `ConcurrentDictionary<K,V>` ...

Details

Author
christian289
Repository
christian289/dotnet-with-claudecode
Created
7 months ago
Last Updated
6 days ago
Language
C#
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category