Anonymous Page Cache

From MozillaWiki
Revision as of 16:37, 15 August 2013 by AlisonW (talk | contribs) (AlisonW moved page AnonymousPageCache to Anonymous Page Cache: no need to use CamelCase - change title to match content usage)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Anonymous Page Cache gives backstores to anonymous pages. For those dynamically generated but rarely used/modified data structures, it tries to save them on disk and load them on demand. The idea is similar to a swap file except:

  • It's in userland and requires no special privilege.
  • The timing and scope to save/swap out is determined by programmer, rather than OS.

Implementation

APC maintains a map to anonymous pages, which is a subset of the virtual memory map, by intercepting calls to the mmap() family. When triggered, it temporarily marks those pages read-only before swapping out to prevent the memory from altered. When the pages in question are written by other threads, the SIGSEGV handler is invoked to cancel the job and reset the memory block which is being swapped out.

References