Skip to content

Instantly share code, notes, and snippets.

@StefanoFiumara
Created November 19, 2013 02:23
Show Gist options
  • Save StefanoFiumara/7539225 to your computer and use it in GitHub Desktop.
Save StefanoFiumara/7539225 to your computer and use it in GitHub Desktop.
if(virtual_memory[index_to_access] == -1) {
//not in ram
//it's on the disk
//call page fault handler
int new_frame = page_fault_handler();
//clear out old frame info
if(ram[new_frame] != -1) {
virtual_memory[ ram[new_frame] ] = -1;
}
//mark page table entry
virtual_memory[index_to_access] = new_frame;
//place page in new_frame index of main memory
ram[new_frame] = index_to_access;
} else {
//it's in ram
//update info for page replacement algorithms
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment