Virtual MemoryBy Justin Poirier
Virtual memory in general refers to a system that allows a memory object to not actually be stored at the address it is referenced by. In practice this usually includes the ability to swap blocks of memory to secondary storage. Virtual memory allows the range of addresses seen by programs (the virtual addresses) to exceed the actual amount of physical memory on the system. This virtual memory space is divided into equal-sized pages.
Virtual memory requires hardware support - typically a memory management unit (MMU) within the CPU. When the CPU sees an address (of the next instruction, or as an instruction's operand) the MMU converts it from virtual to physical by looking up the range within which it falls in the page table - a table in memory used for such mappings. On systems that allow the extension of memory onto secondary storage, the page table is also used to keep track of which pages are currently mapped to physical memory, and which are in secondary memory. If an address is mapped to a page in secondary memory, the MMU issues a page fault to the operating system and the operating system's paging supervisor brings the page back - moving other pages to secondary memory to make room, if need be. Movements of pages back and forth is called swapping.
Thrashing occurs when the system is running out of physical memory so swapping becomes rampant.