virtual-memory-paging-and-tlb

virtual-memory-paging-and-tlb is a skill for Claude Code, Codex from mohitmishra786/low-level-dev-skills. It costs 69 tokens per session (778 once invoked), scanned A, original, MIT.

A guide to virtual memory, the system that maps the addresses programs use to physical locations in computer memory.

In plain words
What is it for?
Use it to understand mmap and demand paging, diagnose segmentation faults and guard pages, and investigate huge pages or TLB pressure.
Why use it?
It explains page tables, the cache of address translations called the TLB, and why missing or restricted pages cause page faults and slowdowns.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to understand mmap and demand paging, diagnose segmentation faults and guard pages, and investigate huge pages or TLB pressure.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohitmishra786/low-level-dev-skills/virtual-memory-paging-and-tlb
Install

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.

Any agent
npx skills add mohitmishra786/low-level-dev-skills --skill virtual-memory-paging-and-tlb
Clone the repo
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for virtual-memory-paging-and-tlb

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/virtual-memory-paging-and-tlb/github.svg)](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/virtual-memory-paging-and-tlb)
Your own site
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/virtual-memory-paging-and-tlb"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/virtual-memory-paging-and-tlb/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.

agentmods 80×15 button for virtual-memory-paging-and-tlb

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/virtual-memory-paging-and-tlb"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/virtual-memory-paging-and-tlb.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 69 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 778 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00069 $0.00778
Opus 5 $0.00034 $0.00389
Sonnet 5 $0.00014 $0.00156
Haiku 4.5 $0.00007 $0.00078

Measured 11d ago against content hash 7996ae2aae20, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

virtual-memory-paging-and-tlb 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.

skills/computer-architecture/virtual-memory-paging-and-tlb/SKILL.md · 97 lines

How it starts

The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Virtual Memory, Paging, and TLB

Purpose

Explain virtual memory: paging, multi-level page tables, TLB role, page faults, and address translation — bridging OS kernels, embedded MPU, and performance analysis.

When to Use

  • Understanding mmap, brk, and demand paging
  • Debugging segfaults and guard pages
  • Huge pages / TLB pressure tuning
  • Contrasting Cortex-M MPU with full MMU systems

Workflow

1. Translation overview

Virtual address (VA)
├── TLB lookup → physical on hit
└── TLB miss → page table walk → fill TLB
        ├── valid PTE → physical address
        └── invalid → page fault (OS handles)

2. Page table (x86-64 4-level example)

CR3 → PML4 → PDPT → PD → PT → physical frame

Linux on x86_64 uses 4 KiB pages (default) and optional 2 MiB / 1 GiB huge pages.

3. Page fault types (simplified)

Fault Typical cause
Major Disk read — file-backed page not in RAM
Minor Zero-fill or COW break
Protection User access to kernel page, W^X violation
# Linux page fault stats
grep pgfault /proc/vmstat

4. TLB pressure

Large sparse address spaces + random pointer chasing → TLB misses dominate.

Mitigations:

  • mmap huge pages (MAP_HUGETLB, madvise(MADV_HUGEPAGE))
  • Smaller working set / better locality
  • numactl --membind for NUMA

5. Embedded contrast (Cortex-M)

Many MCUs use MPU (region-based) not full paging — no TLB, fixed region count. Application processors use MMU + OS.

See skills/platform/riscv-privileged for Sv39/Sv48.

6. Userspace inspection (Linux)

cat /proc/self/maps
pmap -x $$

7. Agent usage

/virtual-memory-paging-and-tlb Explain why 4 KiB random access hurts TLB and hugepage helps

Common Problems

Symptom Cause Fix
Segfault Unmapped VA Fix pointer; check maps
Slow mmap workload TLB thrashing Huge pages; reduce regions
COW spike after fork Shared pages split on write Expected; consider MAP_POPULATE
W^X fault JIT without mprotect dance Separate RW and RX mappings
Wrong phys on MCU No MMU — linear map Use linker script addresses

Read the full file on GitHub · 97 lines

Changes

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.

  1. 11d ago First seen · 97 lines · 69 tokens per session scan A 7996ae2aae20

Subscribe to this mod's changes

virtual-memory-paging-and-tlb is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (202 stars, last pushed 2mo ago), licensed MIT. It adds 69 tokens to every session and 778 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.