OS Kernel Enhancements in xv6
Extended the MIT xv6 teaching kernel with a page swapping subsystem to support memory overcommitment and understand low-level virtual memory management.
- Page Swapping: Implemented swap-out and swap-in routines with a disk-backed swap region, including victim process selection based on resident set size (RSS).
- Page Fault Handling: Modified the trap handler to detect swap-triggered page faults, locate the swapped page on disk, and restore it transparently to the faulting process.
- Victim Selection: Built an accessed-bit aging mechanism to identify cold pages for eviction, minimizing impact on actively-used working sets.
- RSS Tracking: Added per-process resident set size accounting to guide the swap policy and support a memory pressure test program.
Tech: C, x86, QEMU, GNU toolchain.
Tested with a custom memtest program that allocates beyond physical memory to exercise the swap path end-to-end.