원클릭으로
lock-free-data-structure
Implement lock-free and wait-free data structures for high-concurrency systems.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Implement lock-free and wait-free data structures for high-concurrency systems.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Implement abstract machines for defining and executing operational semantics of programming languages.
Implements alias and points-to analysis for pointer programs. Use for: (1) Optimizing compilers, (2) Verifying memory safety, (3) Program understanding, (4) Parallelization.
Define program meaning through logical assertions and proof rules (Hoare logic).
Transforms closures to explicit environments. Use when: (1) Implementing functional languages, (2) Building compilers, (3) Understanding closures.
Implements common subexpression elimination (CSE). Use when: (1) Building compilers, (2) Optimizing code, (3) Program analysis.
Implements general dataflow analysis framework. Use when: (1) Building compilers, (2) Static analysis tools, (3) Program verification.
| name | lock-free-data-structure |
| description | Implement lock-free and wait-free data structures for high-concurrency systems. |
| version | 1.0.0 |
| tags | ["concurrency","lock-free","data-structures","oopsla"] |
| difficulty | advanced |
| languages | ["rust","c++","java"] |
| dependencies | ["concurrency-verifier","memory-allocator"] |
Lock-free data structures allow multiple threads to access shared data without using locks, enabling better scalability and avoiding issues like deadlocks and priority inversion.
| Concept | Description |
|---|---|
| CAS | Compare-And-Swap atomic operation |
| Lock-Free | At least one thread makes progress |
| Wait-Free | Every thread completes in bounded steps |
| Linearizability | Operations appear atomic |
| ABA Problem | Value changes A→B→A, CAS succeeds incorrectly |
| Hazard Pointer | Safe memory reclamation scheme |
concurrency-verifier - Verify correctnessmessage-passing-system - Alternative concurrency modelmemory-allocator - Lock-free allocatorstransactional-memory - Alternative to lock-free| Reference | Why It Matters |
|---|---|
| Herlihy & Shavit "The Art of Multiprocessor Programming" | Comprehensive treatment |
| Maged M. Michael & Michael L. Scott "Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms" (PODC 1996) | Classic queue algorithm |
| Michael "Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects" (TPDS 2004) | Memory reclamation |
| Approach | Pros | Cons |
|---|---|---|
| Lock-free | No deadlocks, scalable | Complex, ABA issues |
| Wait-free | Guaranteed progress | Very complex |
| Lock-based | Simple | Deadlocks, contention |
A high-quality implementation should have:
| Criterion | What to Look For |
|---|---|
| Correctness | Linearizable operations |
| Progress | Lock-free or wait-free |
| Safety | No use-after-free |
| Performance | Scales with thread count |
✅ Good: Linearizable, proper memory reclamation, handles ABA ⚠️ Warning: Works but has memory safety issues ❌ Bad: Race conditions, memory leaks, not actually lock-free
Real-world lock-free data structures:
| Tool | Why It Matters |
|---|---|
| crossbeam (Rust) | Lock-free data structures |
| ConcurrentSkipList | Java concurrent skiplist |
| ConcurrentHashMap | Java CHM |
| boost.lockfree | C++ lock-free |
| disruptor | LMAX Disruptor |
Current lock-free research:
| Direction | Key Papers | Challenge |
|---|---|---|
| Linearizability | "Linearizability" (1990) | Verification |
| Epoch-based | "Epoch Reclamation" | Memory reclamation |
| Hybrid | "Hybrid Reclamation" | Combining approaches |
Common lock-free bugs:
| Pitfall | Real Example | Prevention |
|---|---|---|
| ABA | CAS succeeds on reused node | Tag pointers |
| Memory | Use-after-free | Hazard pointers |
| Ordering | Wrong memory order | Careful ordering |