2) page hits
3) page missing
A dram cache miss is called a page fault ).
VM page fault (Before). The reference to a word in VP 3 is a miss and triggers
Page Fault.
VM page fault (after). The Page Fault Handler selects VP 4 as the victim and
Replaces it with a copy of VP 3 from disk. After the Page Fault Handler restarts
Faulting instruction, it will read the word from memory normally, without generating
An exception.
In the conventional usage of virtual memory, blocks are called pages. Activity receiving and Exchange (swapping) or page Scheduling (paging) on the transfer page between disk and storage ). Wait until the last time, that is, when a hit occurs, this policy is called the demand for page Scheduling (demand paging ).
4) allocation page
Allocating a new virtual page. The kernel allocates VP 5 on disk and points Pte
5 to this new location.
6) use the getrusage function of UNIX to monitor the number of missing pages.
6. virtual memory as a memory management tool
The OS provides an independent page table for each process, which is an independent virtual address space.
How VM provides processes with separate address spaces. The operating maintains
Separate page table for each PROCESS IN THE SYSTEM.
1) Simplified links
Each Linux Process uses the display format.
The user stack is always stretched down from the virtual address 0xbfffffff.ProgramIt always starts from the virtual address 0x08048000, and the shared object is always loaded in the area starting from the virtual address 0x4000000.
2) Simplified sharing
Generally, each process has its own privateCodeThe data, heap, and stack areas do not share pages with other processes.
However, in some cases, it is still necessary for processes to share code, data, such as kernel code and C library functions. By ing appropriate virtual pages in different processes to the same physical page, the OS arranges multiple processes to share a copy of the code.
3) Simplified Memory Allocation
When a program running in a user process requires additional heap space, the OS allocates an appropriate number, such as K consecutive virtual address spaces, and map them to k arbitrary physical pages at any location in the physical memory (it is not necessary to be continuous, it can be distributed discretely ).
4) Simplified Loading
The concept of ing a set of consecutive virtual pages to any location in any file is memory mapping ).
7. virtual memory as a storage protection tool