Giter Club home page Giter Club logo

xv6-swapfile's Introduction

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

xv6-swapfile's People

Contributors

aclements avatar beordle avatar chibby0ne avatar gw avatar icenowy avatar kaashoek avatar kehao95 avatar mikecat avatar phf avatar rsc avatar saarett avatar tchajed avatar zeldovich avatar zrasco avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.