Paging and virtual memory:
Virtual memory is usually implemented by paging. In paging, the low order bits of the binary representation of the virtual address are preserved, and used directly. This is because the low order bits of the actual physical address; the high order bits are treated as a key to one or more address translation tables, which provide the high order bits of the actual physical address.
A range of consecutive addresses in the virtual address space whose size is a power of two will be translated in a corresponding range of consecutive physical addresses because of the above reason. The memory referenced by such a range is called a page.
The page size is typically in the range of 512 to 8192 bytes, though page sizes of 4 megabytes or larger may be used for special purposes. The operating system stores the address translation tables, the mappings from virtual to physical page numbers in a data structure known as a page table.
If a page is marked as unavailable and when the CPU tries to reference a memory location in that page, the MMU responds by raising an exception generally called as page fault with the CPU, which then jumps to a routine in the operating system. If the page is in the swap area, this routine invokes an operation called a page swap to bring in the required page.













