Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add mohitmishra786/low-level-dev-skills --skill memory-hierarchy-and-cachesgit clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/memory-hierarchy-and-caches)<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/memory-hierarchy-and-caches"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/memory-hierarchy-and-caches/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/memory-hierarchy-and-caches"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/memory-hierarchy-and-caches.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00067 | $0.00805 |
| Opus 5 | $0.00034 | $0.00402 |
| Sonnet 5 | $0.00013 | $0.00161 |
| Haiku 4.5 | $0.00007 | $0.00081 |
Grade A, and why
memory-hierarchy-and-caches scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.
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)
Registers
├── L1d / L1i (per core, ~32 KiB, ~4 cycles)
├── L2 (per core, ~256 KiB – 1 MiB)
├── L3 (shared last-level, MiB – tens of MiB)
├── DRAM (hundreds of cycles)
└── Storage / NUMA remote (much slower)
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
/* Bad — two atomics on same cache line */
struct {
atomic_int counter_a;
atomic_int counter_b;
} stats;
/* Good — pad to cache line */
struct alignas(64) {
atomic_int counter_a;
char pad[64 - sizeof(atomic_int)];
atomic_int counter_b;
} stats;
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
#ifdef __builtin_prefetch
for (int i = 0; i < n; i++) {
__builtin_prefetch(&data[i + 8], 0, 3);
process(data[i]);
}
#endif
Hardware stride prefetchers detect sequential access; random access misses.
6. Measurement
perf stat -e cache-references,cache-misses,L1-dcache-load-misses ./app
7. Agent usage
/memory-hierarchy-and-caches Diagnose false sharing in this per-thread stats array
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 |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 11d ago First seen · 102 lines · 67 tokens per session scan A 0185df4a2a5e
memory-hierarchy-and-caches is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (202 stars, last pushed 2mo ago), licensed MIT. It adds 67 tokens to every session and 805 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
ecommerce-growth-strategy
E-commerce growth strategy advisor. Diagnoses current business health using unit economics (CAC, LTV, AOV, contribution margin), identifies the highest-impact growth opportunities across 5 levers (traffic, conversion, AOV, retention, expansion), and builds a prioritized 90-day growth roadmap. Uses the Ansoff Matrix…
ecommerce-ppc-strategy-planner
Cross-platform PPC strategy planner for ecommerce businesses. Analyzes your product and margins, recommends the right advertising platforms (Google Ads, Meta Ads, TikTok Ads), calculates ROAS targets, allocates budget across channels, and generates platform-specific campaign briefs with ad copy and creative direction.…
ecommerce-marketing-strategy-builder
Full-stack e-commerce marketing strategy builder. Analyzes your product, market, and competitors, then builds a complete omnichannel marketing plan covering paid ads, SEO, email/SMS, content marketing, social media, influencer partnerships, and referral programs. Includes target audience persona, competitive…
warehouse-optimization
E-commerce warehouse and inventory optimization advisor. Analyzes inventory health, calculates safety stock and reorder points, performs ABC analysis, evaluates fulfillment costs, and provides actionable recommendations for improving efficiency. Supports all major fulfillment models: Self-fulfillment, Amazon FBA/FBM…
competitor-price-analysis
Competitor pricing strategy analysis and market positioning. Price mapping, pricing gaps identification, elasticity signals evaluation, and strategic pricing optimization. Use when the user asks about competitor pricing, price analysis, pricing strategy, or competitive pricing research.
supply-chain-optimization-tiktok
Supply Chain Bottleneck Analyzer for TikTok Shop sellers. Diagnose cash flow, inventory turnover, affiliate commissions, and return rates. Includes FBT cost analysis, influencer payout optimization, and viral product lifecycle management. No API key required for basic analysis.