Parent Epic: #62
What
Add concurrency primitive patterns to rust-performance SKILL.md. Currently covers async but not lower-level concurrency.
Sections to Add
- Lock-Free Data Structures -- crossbeam epoch-based reclamation, concurrent queues
- Data Parallelism with Rayon --
par_iter(), parallel chunking, custom thread pools
- Atomic Operations -- Ordering levels (Relaxed/Acquire/Release/SeqCst), when to use each
- Thread Pool Configuration -- Custom stack sizes, thread naming, affinity
- Cache Locality in Concurrent Code -- Avoiding false sharing, padding for cache lines
Source Reference
Section 8 (Concurrency Patterns) from RUST_SYSTEM_PROGRAMMING_BEST_PRACTICES.md
Disciplined Engineering Alignment
| Phase |
Skill |
Concurrency Relevance |
| Research |
disciplined-research |
Profile existing code for parallelism opportunities; identify shared-state contention points |
| Design |
disciplined-design |
Specify concurrency strategy (rayon vs crossbeam vs atomics); document memory ordering requirements; design cache-friendly layouts |
| Implementation |
disciplined-implementation |
Implement lock-free structures with safety invariants per step; rayon integration as separate step from correctness |
| Verification |
disciplined-verification |
ThreadSanitizer on all concurrent paths; stress tests with loom for atomic ordering; benchmark parallel vs sequential |
| Validation |
disciplined-validation |
Validate throughput under production load patterns; verify no deadlocks/livelocks under sustained stress |
The SKILL.md should note:
- During research: profile for Amdahl's law -- identify serial bottlenecks before parallelizing
- During design: specify memory ordering rationale for every atomic operation
- During verification:
loom and TSan are mandatory for lock-free code
Relevance to Terraphim
Terraphim uses Aho-Corasick automata with parallel text processing. crossbeam and rayon patterns are directly applicable to search pipeline performance.
Acceptance Criteria
Parent Epic: #62
What
Add concurrency primitive patterns to
rust-performanceSKILL.md. Currently covers async but not lower-level concurrency.Sections to Add
par_iter(), parallel chunking, custom thread poolsSource Reference
Section 8 (Concurrency Patterns) from RUST_SYSTEM_PROGRAMMING_BEST_PRACTICES.md
Disciplined Engineering Alignment
disciplined-researchdisciplined-designdisciplined-implementationdisciplined-verificationloomfor atomic ordering; benchmark parallel vs sequentialdisciplined-validationThe SKILL.md should note:
loomand TSan are mandatory for lock-free codeRelevance to Terraphim
Terraphim uses Aho-Corasick automata with parallel text processing. crossbeam and rayon patterns are directly applicable to search pipeline performance.
Acceptance Criteria