Basic operation:
When virtual memory is used, or when a main memory location is read or written to by the CPU, hardware within the computer translates the address of the memory location generated by the software (the virtual memory address) into either:
the address of a real memory location (the physical memory address) which is assigned within the computer's physical memory to hold that memory item, or
an indication that the desired memory item is not currently resident in main memory (a so-called virtual memory exception)
In the former case, the memory reference operation is completed, just as if the virtual memory were not involved. In the latter case, the operating system is invoked to handle the situation, since the actions needed before the program can continue are usually quite complex. The hardware that supports virtual memory supports memory protection mechanisms also in most cases.












