Virtual Memory Primitives for User Programs
Reviewed by Zhiyuan Chen, Feb. 16.
Idea
- The page protection hardware in virtual memory is used for many tricks in Operating
Systems, such as sharing, making code reentrant, etc.
- It is cool for user applications to do similar tricks. So this paper checks the set of
VM primitives OS should provide for user programs and how well current OS provide them.
- Authors also check the implementation issues of this set of primitives.
Tricks and VM primitives
- Primitives:
- TRAP (handle page-fault trap in user mode)
- PROT1 ( Protect one page, i.e., decrease accessibility of a page)
- PROTN ( Protect a bunch of pages, for efficiency purpose)
- UNPROT ( Unprotect one page )
- DIRTY (return a list of dirtied pages since previous call)
- MAP2 (map the same physical page at two different virtual addresses, at different level
of protection.)
- Tricks: ( common model: user-mode service routines for page fault + user-mode client
routines, client routines invoke page-fault)
- Concurrent garbage collection.(protect unscanned area for mutator, when trap, invoke
collector)
- Shared virtual memory. ( protect from write)
- Concurrent checkpointing. ( similar to garbage collection, service routine is
checkpointing )
- Generational garbage collection. ( record modification to old generation. Protect them
and record when handle page fault)
- Persistent stores. (use garbage collection at commit time)
- Extending addressability. ( when bring into memory at the first time, transfer pointer
from 64 bits to 32 bits)
- Data-compression paging. ( when page fault, compress it)
- Heap overflow detection. ( Instead of check each time, use a gard page and cause fault
when overflow)
Performance comparison and Implementation Issues
- Charateristcs of above tricks:
- in memory operations( cost proportional to page size).
- Decrease accessiblity in batches, increase individully.
- frequency of fault inversely related to locality.
- User mode service routines need to access pages protected from user-mode client.
- Comparison of current OS implementation performance: ( Page 8, Figure 2), Cool
i386+NX/2, poor Mach.
- What matters for performance: page size(smaller desired, different size from disk page,
use hardware), OS overhead for fault handler, locality. Pipeline machines ( all are
asynchronous algorithms except heap overflow detection).
- Other issues:
- TLB consistency, when decrease accessibility of a page, needs flush that page from TLB.
(shoot-down problem, decrease cost by batche the shoot-down.
- Enalbe service routine access pages client can not access. reasonalbe way: mutiple
mapping of same page at different address.The consistency problem is easy to solve in
above applications.
Questions
- Do you think these applications very useful? What is the advantage of using page
protection in those applications?
- Why Mach's performance is so poor?
- Does NT provides such primitives? If not, can we still implement above algorithms
efficiently?