20. in-depth understanding of computer system notes, virtual memory, and basic principles (2)

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.