Anonymous Page Cache

From MozillaWiki
(Redirected from AnonymousPageCache)
Jump to: navigation, 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