d9e5668cec
Fixes and improvements from exhaustive audit: Consistency fixes in SKILL.md: - 'Pipe & Filter' → 'Pipe and Filter' (one stray '&' found and corrected) - 'Singleton for factory instance' → clarified to 'register factory as singleton-scoped via DI container' (less misleading wording) - Documentation Format section updated with note that SKILL.md itself is the authoritative source for related-pattern combinations Coverage fix — Related Patterns sections: - Added '## Related Patterns' to ALL 94 pattern files (was 0/94) - Each section lists 3–6 related patterns with relationship descriptions - Covers: why they're related, when to prefer one vs the other, and which are often confused SOLID principles → Creational → Structural → Behavioral → Architectural → Concurrency → Functional → Resilience → Data Access → Messaging → Testing → Error Handling → Microservice — all 13 categories covered Code verification: - Python: 0 failures (all 85 testable blocks pass) - Go: 0 failures (all 76 testable blocks pass) - JavaScript: 0 failures (all 78 testable blocks pass) - All 239 code blocks verified correct after edits Final skill state: - 108 files, 36,524 lines across 13 reference categories - 94/94 pattern files have Related Patterns sections - 2,815-line SKILL.md with 67 decision trees, 23 scenarios, 0 broken references, 0 naming inconsistencies
Concurrency Patterns
Overview
Concurrency patterns address the challenges of executing multiple computations simultaneously, managing shared resources, synchronizing threads, and structuring asynchronous workflows. These patterns are essential for building responsive, high-throughput systems.
Patterns in This Category
| Pattern | Purpose | Key Mechanism |
|---|---|---|
| Producer-Consumer | Decouple data production from consumption | Shared bounded queue |
| Read-Write Lock | Allow concurrent reads, exclusive writes | RWMutex / RWLock |
| Thread Pool | Reuse a fixed set of workers | Worker pool with task queue |
| Future / Promise | Represent a value not yet available | Async result placeholder |
| Actor Model | Isolate state behind message-passing actors | Mailbox queues |
| Reactor | Demultiplex I/O events on a single thread | Event loop + handlers |
| Monitor | Protect shared state with mutex + conditions | Condition variables |
| Active Object | Decouple method invocation from execution | Request queue + scheduler |
When to Use Concurrency Patterns
- I/O-bound workloads: Reactor, Future/Promise, Actor Model
- CPU-bound workloads: Thread Pool, Producer-Consumer
- Shared mutable state: Monitor, Read-Write Lock
- Message-driven architectures: Actor Model, Active Object
- Event-driven systems: Reactor
General Principles
- Prefer message passing over shared memory when possible.
- Minimize critical sections to reduce contention.
- Avoid nested locks to prevent deadlocks.
- Use bounded queues to apply backpressure.
- Design for cancellation and timeout in all async operations.