Basic knowledge of Linux: Memory Addressing

Source: Internet
Author: User
Q1. what is a physical address? What is a virtual address? What is a linear address? A: 1) define the memory space provided by the physical memory stick on the motherboard as the physical memory space. the actual address of each memory unit is the physical address. 2) define the memory space seen by the application programmer as a virtual location... information & nb

Q1. what is a physical address? What is a virtual address? What is a linear address?

A:

1) define the memory space provided by the physical memory stick on the motherboard as the physical memory space. the actual address of each memory unit is the physical address;

2) define the memory space seen by the application programmer as a virtual address space (or address space). The address is called a virtual address (or virtual address). Generally, the "segment: offset, for example, A815: CF2D;

3) linear address space refers to a continuous, non-segmented range of 0 ~ 4 GB address space. a linear address is an absolute address of a linear address space.

 

Q2. in protection mode, how does MMU convert a virtual address to a physical address?

A: In protection mode, the memory management unit (MMU) is composed of one or more chips. its function is to map virtual addresses to physical addresses, that is, address translation; MMU is a hardware circuit. it consists of two parts: segmentation and paging. the segmentation mechanism converts a virtual address into a linear address, the paging mechanism converts a linear address to a physical address.

 

Q3. why are two-level page tables used for 32-bit linear address space?

A: A page table is A data structure that maps linear addresses to physical addresses. A 4 GB linear space can be divided into 1 m pages with A size of 4 kB. each page table item occupies 4 bytes, a page table with 1 million page items occupies 4 MB of space and must be continuous. Therefore, two-level page tables are used. two-level page tables are used to pagination the page tables, the first level is called the page directory, where information about the page table is stored; the 4 MB page table is paged again and can be divided into 1 k pages of 4 kb size.

 

Q4. what is the role of page cache? Why does Linux mainly use a page splitting mechanism for virtual storage management? Why does it use the three-level paging mode instead of the two-level paging mode?

A:

1) the page cache automatically retains the 32 items recently used by the processor, so it can cover the memory in the range of KB;

2) Linux mainly uses a page splitting mechanism for virtual memory management. The reason is:

A. Linux's segmentation mechanism makes all processes use the same segment register, which simplifies memory management;

B. one of Linux's design goals is to be transplanted to the vast majority of popular processing platforms, but many of them support very limited segment functions. to ensure portability, Linux uses a three-level paging mode, because many processors use a 64-bit structure, Linux defines three types of page tables: page Directory (PGD), intermediate Directory (PMD), and page table (PT)

From: Column of zhouzxi

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.