|
|
|
|
|
HP-UX Memory Management: White Paper > Chapter 1 MEMORY MANAGEMENTTHE ABSTRACTION OF VIRTUAL MEMORY |
|
A computer has a finite amount of RAM available, but each HP-UX process has a 4GB virtual address space apportioned in four one-gigabyte quadrants, termed virtual memory. Virtual memory is the software construct that allows each process sufficient computational space in which to execute. It is accomplished with hardware support. As software is compiled and run, it generates virtual addresses that provide programmers with memory space many times larger than physical memory alone. The number of bits available for the space determines the ultimate size of the virtual address space. At PA-RISC 1.x, the operating system has 32-bit physical addressing and 48-bit virtual addressing (the latter consisting of 16-bit space and 32-bit offset to allow for 4 GB per space); the total virtual address range is (2 ^ 16) * 4 GB = 262,144 GB By comparison, Level 2 has a far greater total virtual address range of ( 2 ^ 32 ) * 4 GB = 17,179,869,184 GB
A physical address points to a page in memory that represents 4096 bytes of data. The physical address also contains an offset into this page. Thus, the complete physical address is composed of a physical page number(PPN) and page offset. The PPN is the 20 most significant bits of the physical address where the page is located. These bits are concatenated with an 12-bit page offset to form the 32-bit physical address. To handle the translation of the virtual address to a physical address the virtual address also needs to be looked at as a virtual page number(VPN) and page offset. Since the page size is 4096 bytes, the low order 12 bits of the offset are assumed to be the offset into the page. The space ID and the high order 20 bits of the offset are the VPN. For any given address you can determine the page number by discarding the least significant 12 bits. What remains is the virtual page number for a virtual address or the physical page number for the physical address. The next figure shows the bit layout of a virtual address of 0x0.4873. The virtual page number's address must be translated to obtain the associated physical page number, with page offset 0x873. |
|||||||||||||||||||||||||||||||||
|
|
|||||||||