zrasco / xv6-swapfile

Modification of xv6 OS for independent research project at UNLV.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extended the xv6 OS to include a Virtual Memory Manager with swapfile support and LRU cache. Supervised by Ed Jorgensen and Dr. Ajoy Datta in 2018 during my senior year at UNLV (RIP Dr. Datta :( )


Changes made:

console.c
---------
printaddr() method added
changed %p to print address instead of integer

defs.h
-------
Added struct vminfo_struct;
All new functions from kalloc.c
procsmemorystats() and find_proc_pte() from proc.c
vminfo and pgtabinfo internal functions from vm.c
swapfile functions from swap.c & usermode swapfile initialization in swapuser.c

exec.c
------
Removes LRU mappings from process before exec() overwrites page table
Debug output & new statistics for processes initialized

file.h & fs.c & fs.h
------
Support for double inode indirection added (for larger swapfile)

init.c
-------
init now spawns a temporary process to inititalize the swapfile before executing the shell

kalloc.c
---------
added statistical fields to kmem
kswapmem data structure
Added invoke_swapper(), kmaxprocsize(), kexistfreepages(), kfreepagecnt(), kallocatedpages(), kallocbeginning(), kgetfreelistptr()
freerange() debug info printing
kalloc() now invokes swapper to give a page, if none available

main.c
-------
Added kswapinit() step to initialize the swap space, just before userinit()

Makefile
--------
Now links swap.o
Now links swapuser.o (ULIB args)
Added 8MB SWAPFILE to fs.img
UPROGS now includes zeb_test
EXTRA now includes zeb_test.c, swap.c and swapuser.o

memlayout.h
------------
PHYSTOP changed to various values (commented out) for testing swapping

mkfs.c
-------
Debugging info added to main(), currently commented out (for doubly-indirect inodes)
balloc()/iappend() modified to allow doubly-indirect inodes

param.h
-------
FSSIZE increased from 1000 to 20985 for larger file system

printf.h
-------
printaddr() function added
%p and %x now print addresses, not integers

proc.h
-------
Statistical fields related to swapping and page faults added

swap.h, swap.c, swapuser.c (No modifications, files did not previously exist.)
------
Contains kernel & user swap/LRU API header & implementation

syscall.c & syscall.h & sysfile.c
---------
4 system calls added: vminfo, pgtabinfo, setswapfilefd, sbrk_force_swapout

sysproc.c
---------
sys_sbrk() modified for lazy allocation
sys_sbrk_force_swapout(), sys_vminfo(), and sys_pgtabinfo() added

trap.c
---------
Support for NULL reference protection, lazy allocation, swapping, and LRU added

types.h
---------
Added NULL constant and vminfo_struct data structure

user.h
-------
Added vminfo(), pgtabinfo(), setswapfilefd(), sbrk_force_swapout(), and swapinit() usermode API calls

usys.S
-------
Added vminfo, pgtabinfo, setswapfilefd, and sbrk_force_swapout system calls

vm.c
-----
Added support to copyuvm for lazy allocation, swapping, and LRU
Added vminfo_internal() & pgtabinfo_internal() methods

zeb_test.c
-----------
Various tests of functionality added for virtual memory

About

Modification of xv6 OS for independent research project at UNLV.

License:Other


Languages

Language:C 83.7%Language:C++ 4.8%Language:Assembly 3.0%Language:Makefile 2.6%Language:Shell 1.8%Language:Perl 1.6%Language:Objective-C 1.1%Language:Ruby 0.8%Language:OpenEdge ABL 0.6%Language:Emacs Lisp 0.0%