Virtual Memory Computer Architecture
In Computer Architecture, Virtual memory is a technique used in computing to optimize memory management by transferring data between different storage systems, such as RAM and Disk Storage. It is used to store application data and instructions that are currently not needed to be processed by the CPU. Virtual memory enables a system to run applications larger than the main memory.
The disk seen by the CPU as virtual memory, if the CPU has 16 address lines, then the size of virtual memory will be 216 B. Application residing in the disk called process. When a user runs a program, the operating system moves the pages of the process into the main memory. Virtual memory divided into pages as shown below figure. Process A occupied pages P0 through P4, and process B occupied pages P5–P9.
The CPU generates a virtual address (to access an address in the disk) of V-bits. These bits divided into two identifiers: a virtual page number of M bits and a page offset of N bits as shown above figure. The total number of pages in the system is equal to 2M, and the number of bytes (in a byte-addressable system) in a page is equal to 2N. The total number of addresses in a system is equal to 2(N+M) or 2V.