mohitmishra786/low-level-dev-skills/memory-hierarchy-and-caches
Claude Code and agent skill by mohitmishra786/low-level-dev-skills
- community
Checking that the SKILL.md file is still in the repository.
Memory hierarchy skill for caches, coherence, and locality. Use when explaining cache levels, associativity, false sharing, prefetching, or MESI coherence. Activates on queries about cache hierarchy, L1 L2 L3, false sharing, cache line, prefetch, or cache coherence.
Install
npx vskill@latest install mohitmishra786/low-level-dev-skills/memory-hierarchy-and-cachesSKILL.md
Memory Hierarchy and Caches
Purpose
Teach CPU memory hierarchy: cache levels, associativity, line size, coherence protocols, false sharing, and prefetch behavior — architectural depth complementing optimization practice in skills/low-level-programming/cpu-cache-opt.
When to Use
- Explaining why padding fixes scalability
- Choosing struct layout for multicore
- Interpreting cache miss counters
- Understanding DMA vs CPU cache on embedded SoCs
Workflow
1. Hierarchy (typical desktop/ server)
Embedded MCUs may have only tightly-coupled memory (no L2/L3).
2. Cache line and associativity
- Line size: commonly 64 bytes on x86/ARM64 (verify with
getconf LEVEL1_DCACHE_LINESIZE) - Set-associative: line maps to one set, competes within ways
- Conflict misses: many aliases same set
3. False sharing
4. Coherence (multicore)
MESI states: Modified, Exclusive, Shared, Invalid. Writes invalidate other cores' copies of the line — why atomics and locks ping cache lines.
5. Prefetching
Hardware stride prefetchers detect sequential access; random access misses.
6. Measurement
7. Agent usage
Common Problems
| Symptom | Cause | Fix | |
|---|---|---|---|
| Scaling collapses | False sharing | Line-align per-thread data | |
| High LLC misses | Working set > cache | Block algorithms; NUMA pin | |
| DMA incoherence | CPU cache vs device | Flush/invalidate on MCU; dma_sync on Linux | |
| Prefetch hurt | irregular access | Remove manual prefetch | |
| Huge struct copies | AoS cold lines | SoA layout — see cpu-cache-opt |
Related Skills
skills/low-level-programming/cpu-cache-opt— practical optimizationskills/computer-architecture/cpu-pipelines-and-hazards— load-use stallsskills/computer-architecture/virtual-memory-paging-and-tlb— TLB missesskills/allocators/numa-programming— remote memory latencyskills/profilers/hardware-counters— perf counter events
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/computer-architecture/memory-hierarchy-and-caches/SKILL.md
Popularity
- Repository stars
- 237
- Repository forks
- 28
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mohitmishra786/low-level-dev-skills/memory-hierarchy-and-caches)