processing-parallel-tasks — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited processing-parallel-tasks (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
A guide for APIs and patterns for parallel processing of CPU-bound tasks.
Quick Reference: See QUICKREF.md for essential patterns at a glance.
| 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 |
public sealed class ImageProcessor
{
public void ProcessImages(IEnumerable<string> imagePaths)
{
var options = new ParallelOptions
{
MaxDegreeOfParallelism = Environment.ProcessorCount
};
Parallel.ForEach(imagePaths, options, path =>
{
ProcessImage(path);
});
}
}Parallel.For(0, data.Length, (i, state) =>
{
if (data[i] == target)
{
state.Break();
}
});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();| Collection | Purpose |
|---|---|
ConcurrentDictionary<K,V> | Thread-safe dictionary |
ConcurrentQueue<T> | Thread-safe FIFO queue |
ConcurrentBag<T> | Thread-safe unordered collection |
// Collecting results during parallel processing
var results = new ConcurrentBag<Result>();
Parallel.ForEach(data, item =>
{
var result = Process(item);
results.Add(result);
});Prevents contention with thread-local variables
private readonly ThreadLocal<StringBuilder> _localBuilder =
new(() => new StringBuilder());
public void ProcessInParallel()
{
Parallel.For(0, 1000, i =>
{
var sb = _localBuilder.Value!;
sb.Clear();
sb.Append(i);
});
}// ❌ Using Parallel for I/O operations
Parallel.ForEach(urls, url => httpClient.GetAsync(url).Result);
// ✅ Using async-await for I/O operations
await Task.WhenAll(urls.Select(url => httpClient.GetAsync(url)));// ❌ Parallel writes to regular collection
var list = new List<int>();
Parallel.For(0, 1000, i => list.Add(i)); // Race condition!
// ✅ Using thread-safe collection
var bag = new ConcurrentBag<int>();
Parallel.For(0, 1000, i => bag.Add(i));~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.