Operating system memory address (logical address, linear address, physical address) concept

Source: Internet
Author: User

logical addresses (Logical address)        means thatrelated to a segment generated by a programOffset Address Section. For example, you can read the pointer variable itself (& operation) in the C language pointer programming, which is actually the logical address, which is relative to the address of the data segment of your current process and is not coherent with the absolute physical address. Only in Intel Real mode will the logical address be equal to the physical address (because there is no fragmentation or paging mechanism for the real mode, the CPU does not perform automatic address translation), and the logic is the offset address of the code snippet in Intel protected mode (assuming that the code snippet, the data segment is exactly the same). The application programmer only has to deal with logical addresses, and the segmentation and paging mechanisms are completely transparent to you, and are only covered by system programmers. While the application programmer can manipulate the memory directly, it will only operate on the memory segments assigned to you by the operating system. Linear addresses (Linear address)        is the middle tier between the logical address and the physical address transformation. The program code generates a logical address, orThe offset address in the segment, plus the base address of the corresponding segment, generates a linear address. If the paging mechanism is enabled, the linear address can then be transformed to produce a physical address. If the paging mechanism is not enabled, then the linear address is the physical address directly. The Intel 80386 has a linear address space capacity of 4G (2 of 32 address bus addressing). Physical addresses (physical address)        refers to the presencein theCPU external address bus onAddress signal for addressing physical memory, which is the end result address of the address transformation. If the paging mechanism is enabled, the linear address is transformed into a physical address using the items in the page directory and the page table. If the paging mechanism is not enabled, then the linear address becomes the physical address directly. Virtual Memory (Vsan)        refers to the amount of memory that the computer presents that is much larger than the actual memory. So it allows programmers to compile and run programs that are much larger in memory than the actual system. This enables many large projects to be implemented on systems with limited memory resources. In the Linux 0.11 kernel, each program (process) is divided into a total capacity of 64MB of virtual memory space. So the program's logical address range is 0x0000000 to 0x4000000.         principle of locality: The program willnon-uniformGround,highly localizedAccess to Memory        Virtual Memory: Hasrequest incoming, replace function(logically "spread out" in >> out of memory)        page break, pages replacement algorithm:        Sometimes we also putA logical address is called a virtual address. Because similar to the concept of virtual memory space, the logical address is independent of the actual physical memory capacity. The "gap" between the logical address and the physical address is 0xc0000000, due to the exact difference between the virtual address, the linear address, and the physical address mapping. This value is specified by the operating system. Summarize        The conversion method of virtual address to physical address is architecture-related. Generally, there are two ways of segmenting and paging. Take the current x86 CPU as an example, the segmented paging is supported. The Memory mangement Unit is responsible for conversions from virtual addresses to physical addresses. The logical address is the form of the segment identifier + offset within the segment, and the MMU can convert the logical address to a linear address by querying the segment table.. If the CPU does not turn on paging function, then the linear address is the physical address;if the CPU turns on paging, the MMU also needs to query the page table to convert the linear address into a physical address.: Logical Address----(segment table)---> Linear address-Physical address-(page table)         Different logical addresses can be mapped to the same linear address, and different linear addresses can be mapped to the same physical address ; So it's a many-to-one relationship. In addition, the same linear address may be reloaded to another physical address after a page change occurs. So this many-to-one mapping also changes over time. Reference Source: http://laoxu.blog.51cto.com/4120547/1166661



From for notes (Wiz)



Operating system memory address (logical address, linear address, physical address) concept

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.