P

PrepStack

Virtual Memory and Page Replacement

Virtual memory means the memory a program thinks it has is not the same as the real memory (RAM, the computer's fast working memory) in the machine. Only the pages (equal-sized program pieces) in use stay in RAM; the rest stay on disk. Interviewers ask about page faults (using a page that is not in RAM), page replacement (choosing which page to remove), Belady's anomaly (more memory making things worse) and thrashing (spending all the time moving pages).

After this section you can explain demand paging, walk through a page fault, count faults for FIFO, LRU and optimal, and explain Belady's anomaly and thrashing. Example numbers are made up unless a source is named.

Topics in this section