Memory Model
Guide to C++ and Rust memory orderings, happens-before reasoning, and lock-free patterns, with futex and rseq coverage.
- CCM score
- 58 of 100
- skills.sh installs
- 800
- GitHub stars
- 303
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers memory orderings from Relaxed through SeqCst, with side-by-side C++ and Rust equivalents for each
- Includes decision guidance for common cases: counters, reference counting, publish/subscribe, spinlocks, and lock-free queues
- Provides worked examples for a spinlock, a reference-counted object, a lazy initializer, and Rust publish/subscribe flags
- Covers atomic fences and a futex_waitv example that sleeps on two futexes and wakes on either
- Designed for developers writing concurrent C++ or Rust code who need to pick the weakest correct atomic ordering
Install
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill memory-model -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Memory Model
Purpose
Guide agents through C++ and Rust memory models: memory orderings, the happens-before relation, atomic operations, fences, and practical patterns for lock-free data structures.
Triggers
- "What is the C++ memory model?"
- "What memory order should I use for my atomic operation?"
- "What is the difference between acquire-release and seq_cst?"
- "How do I use std::atomic in C++?"
- "What is acquire/release in Rust atomics?"
- "How do I implement a lock-free queue?"
Workflow
1. Memory ordering overview
Modern CPUs and compilers reorder operations for performance. The memory model specifies what reorderings are allowed and how synchronisation is achieved.
Ordering strength (weakest to strongest):
Relaxed < Release/Acquire < AcqRel < SeqCst
Stronger ordering = more synchronization = more correct, but slower
Weaker ordering = fewer barriers = faster, but needs careful analysis
2. Memory orderings
Details
- Repository
- github.com/mohitmishra786/low-level-dev-skills
- Category
- Rust
- First seen
- Jun 3, 2026
Questions
What does the memory-model skill cover?
The memory-model skill guides agents through C++ and Rust memory models, including memory orderings, the happens-before relation, std::atomic and Rust atomics, fences, and lock-free patterns. It also covers futexes such as futex_waitv and rseq for custom synchronization.
How do I install the memory-model skill?
Run npx -y skills add mohitmishra786/low-level-dev-skills --skill memory-model -y in your project. Once installed, memory-model lets the agent choose the correct memory order for atomic operations and diagnose data races.
Where does memory-model rank in the Rust category?
memory-model is listed in the Rust category on Claude Marketplaces and ranks in the top 100 there. Its sibling skills fix-errors, rust-best-practices, rust-async-patterns, rust-testing and rust-patterns sit alongside it in that category.
When should I use the memory-model skill?
Use memory-model when you need to understand acquire-release, seq_cst or relaxed atomics, write a lock-free data structure, or diagnose a data race. It also activates on queries about happens-before, memory barriers and Rust atomic ordering.
More from mohitmishra786/low-level-dev-skills
All 54- Make789
- Heaptrack779
- Ninja778
- Freertos774
- Linux Kernel Modules772
- Msvc Cl772
- Ebpf765
- Fuzzing761
- Binutils759
- Linkers Lto753
- Conan Vcpkg747
- Rust Security744
- Dynamic Linking737
- Rust Ffi713
- Rust Sanitizers Miri713
- Rust Unsafe705
- Pgo695
- Interpreters689
- Cargo Workflows686
- Meson685
- Rust Debugging676
- Cpp Modules669
- Hardware Counters666
- Debug Optimized Builds652
Similar to Memory Model
More Rustmemory-safety-patternswshobson/agents12.6K installsCross-language memory-safety patterns covering RAII, ownership, smart pointers, and resource management for Rust, C++, and C.
rust-systems-programmingmanutej/luxor-claude-marketplace494 installsComplete Rust guide covering ownership, borrowing, concurrency, async, and unsafe code for memory-safe systems work.
golang-concurrencysamber/cc-skills-golang45.3K installsGo concurrency design guide covering goroutine lifecycles, channels, sync primitives, and worker pools.
m02-resourceactionbook/rust-skills3.9K installsChoosing Rust smart pointers by ownership model, thread context, and reference cycles, with a decision flowchart.