Lecture 15: Virtual Memory & Paging
By: Aditya Kajla & Jay Topiwala
A Process's virtual space:
fd = open("foo", O_RDWR | O_CREAT | O_TRUNC, 0600);
lseek(fd, 10000000000000, SEEK_CUR);
write(fd, "x", 1); //creates a sparse file
size_t pmap(int vpn) {
int hi = vpn >> 10;
int lo = vpn & ((1 << 10) - 1);
int *topage = PAGETABLE[hi]; // register cr3
if (!topage)
return FAULT;
}
Page Faults:
Page Replacement Policies:
More Optimizations: