VM provides the answers to both limited memory as well as memory protection, which involves safe sharing of memory among multiple programs. Different processors vary in their actual implementation of VM. Therefore, although the general concepts remain the same, we will focus on the MIPS processor's implementation when going into more detail.
Implementing Virtual Memory
The levels that virtual memory deals with are main memory (often called physical memory) and secondary storage. Information or data is passed between these two levels. The unit of information is called a block, and entire blocks are copied between levels. In virtual memory, a block is called a page.
Paging is a current approach used in all modern or general purpose operating systems to implement virtual memory. It divides the memory of a process into fixed sized pages, typically 4K. Pages are swapped in and out of main memory when needed. This essentially gives the end-user the illusion that there is an infinite amount of memory because only a portion of the memory is active at any one time. It's critical to keep track of these pages. The page table, which resides in memory, is used to accomplish this action and also acts as an index to the main memory. A page table register points to the start of the page table and is used to locate the page table in memory.
Every entry in the page table contains certain bits to help identify the pages.