• Customers
  • Pricing
  • Docs
Sign Up

Compute Glossary

How computers for agents work, from the hardware to the sandbox.

  1. Compute Glossary
  2. /
  3. Kernel

Memory page

Also called Page

Physical memoryFrames in usePage tableVirtual pagesNot mapped, page fault

A memory page is the fixed-size block in which the kernel maps and protects memory. Every virtual address that a process uses falls in one page, which the processor translates to a page frame in physical memory. The processor supports a few page sizes, and the kernel uses the smallest for most memory. A program that asks for a few bytes gets them from a library allocator, which in turn takes whole pages from the kernel.

Working in pages lets the kernel place the memory of a process anywhere in physical memory, in any order. It also lets the kernel keep only the pages in use in memory and leave the rest on disk or unallocated. Physical memory never has to be contiguous, so a process can grow without the kernel finding one large free block for it. A process can even reserve more memory than the machine has, as long as it never touches it all.

Each page carries its own permissions, such as whether it may be written or run as code. Most of what a kernel does with memory, from sharing to swapping, it does one page at a time. Marking code pages as not writable and data pages as not executable blocks a whole class of attacks. Two processes can also map the same page frame, which is how a shared library takes up memory only once.

Page tables

Page tables are the structures through which the processor turns a virtual address into a physical one. They form a tree of several levels, and the processor walks that tree in hardware for each translation it has not cached. Each process has its own tree, and the kernel switches trees when it switches processes. The tree holds entries only for the regions in use, so a mostly empty address space costs little.

A walk takes several memory reads, so the processor keeps recent translations in a translation lookaside buffer. A program that touches more pages than that buffer covers spends a noticeable share of its time on walks. Switching processes can also flush that buffer, unless the processor tags each entry with its address space. Most modern processors do, which makes switches cheaper.

Huge pages ease this by letting one entry cover far more memory. They suit programs with large working sets, such as databases, at the cost of coarser allocation. A huge page needs one contiguous run of physical memory, which gets harder to find the longer a machine runs. Linux can assemble huge pages on the fly or reserve them at boot.

Page sizeDescription
4 KiBA 4 KiB page is the usual size.
2 MiBA 2 MiB huge page on x86-64 cuts translation work for programs with large memory.
1 GiBA 1 GiB huge page on x86-64 suits programs that touch very large amounts of memory.

Page faults

Page faults are the traps the processor raises when a program touches a page that its page table does not map for that access. The kernel then decides whether the access is legal and, if it is, fixes the mapping and resumes the program. If the access is illegal, the kernel sends the program a signal, which on Unix-like systems usually ends it with a segmentation fault. The program never sees the legal faults at all.

Most faults are routine, because kernels allocate memory lazily and map a page only when it is first touched. Copy-on-write works the same way, copying a shared page only on the first write. Memory-mapped files load the same way, page by page as the program reads them. A program can therefore map a large file and pay only for the parts it uses.

A fault that has to read the page back from disk takes far longer than one served from memory. Some such faults are normal, for example when a program reads a file mapped into memory. Pages swapped back in again and again, while the kernel keeps evicting others, mean the machine is short of memory. In the worst case the system spends more time moving pages than running programs, which is called thrashing. Adding memory or running fewer programs is then the only real fix.

Second-level translation

Second-level translation is the extra step of address translation that a virtual machine adds. The guest kernel maps its virtual addresses to what it takes for physical memory, and the hypervisor maps those guest-physical pages to real host memory. Two sets of tables are needed because the guest kernel expects to manage physical memory itself. The hypervisor lets it, while keeping the final say over which host pages back the guest.

Modern processors walk both sets of tables in hardware, a feature of hardware virtualization. A miss in the translation lookaside buffer then costs many more memory reads, because each step of the guest walk needs a host walk of its own. A walk that is cheap on bare metal can therefore cost several times as much inside a guest. Larger translation buffers and caches for partial walks soften that cost.

Huge pages on the host therefore help guests even more than ordinary programs. A host huge page shortens the host part of every nested walk, so a guest gains even when its own pages are small. The second set of tables also lets the host move or reclaim guest pages without the guest noticing. That freedom is what lets a host merge identical pages across guests or swap a guest out under pressure.

Related terms

  • Memory
  • Hardware virtualization
PreviousProcessNextNamespace

On this page

Compute Glossary
  1. Foundations
    • Sandbox
    • Virtual machine
    • vCPU
    • Block storage
    • Virtual network interface
    • Kernel
    • Hardware virtualization
    • Hypervisor
    • GPU
    • CPU core
    • Memory
    • CPU
    • Local disk
    • Network interface card
    • Compute
    • Workload
    • Latency
  2. Sandboxes
    • Isolation
    • Lifecycle
    • Snapshot
    • Persistence
  3. Virtualization
    • KVM
    • MicroVM
    • Container
  4. Hardware
    • Server
    • CPU architecture
    • CPU type
    • GPU memory
    • GPU model
    • Mac model
  5. Kernel
    • System call
    • Process
    • Memory page
    • Namespace
    • Control group
    • Seccomp
  6. Storage
    • Object storage
    • File system
  7. Networking
    • Egress control
    • SSH
  8. Infrastructure
    • Control plane
    • Scheduler
    • Overcommit
    • Preemption
    • Region
    • Capacity
    • Scale
  9. Agents
    • AI agent
    • Tool call
    • Untrusted code
  10. Reinforcement learning
    • Reinforcement learning
    • Environment
    • Rollout
    • Verifier
    • Reward hacking
    • Actor–learner architecture

Computersfor Agents

Isolated sandboxes for agent code,
ready in under 100 ms.

Start for Free

Subscribe to DotFiles Insider, our monthly digest of AI infrastructure news, deep dives, and Daytona product releases.

Company

  • About
  • Careers
  • Brand
  • Partners
  • Startup Program
  • Research Grants
  • Events
  • Contact

Product

  • Pricing
  • Docs
  • Changelog

Resources

  • Guides
  • Blog

Legal

  • DPA
  • SLA
  • Terms of Service
  • Privacy Policy
Trust Center
All Systems Operational