Virtual Memory, logical address, linear address, physical address

Source: Internet
Author: User
Tags field table
 
 
 

A logical address is a segment-related offset generated by a program. For example, you can read the value (& operation) of the pointer variable in the C language pointer programming. In fact, this value is the logical address, which is relative to the address of the Data Segment of your current process, it is not related to an absolute physical address. The logical address is equal to the physical address only in Intel real mode (because the real mode does not have a segmentation or paging mechanism, the CPU does not perform automatic address translation ); the logic is the offset address within the limit of the code segment executed by the program in Intel protection mode (assuming that the code segment and data segment are exactly the same ). Application programmers only need to deal with logical addresses, while the segmentation and paging mechanisms are completely transparent to you and are only involved by system programmers. Although the application programmer can directly operate the memory, it can only operate on the memory segment allocated to you by the operating system.
Linear address is the intermediate layer between Logical Address and physical address transformation. The program code will generate a logical address, or an offset address in the segment. A linear address is generated by adding the base address of the corresponding segment. If the paging mechanism is enabled, linear addresses can be transformed to generate a physical address. If the paging mechanism is not enabled, linear addresses are physical addresses. Intel 80386 linear address space is 4 GB (2 to the power of 32 address bus addressing ).
Physical address refers to the address signal indicating the addressing physical memory on the CPU external address bus. It is the final result address of address transformation. If the paging mechanism is enabled, linear addresses are converted to physical addresses using the items in the page Directory and page table. If the paging mechanism is not enabled, the linear address directly becomes a physical address.
Virtual Memory refers to the amount of memory displayed on a computer that is much larger than the actual memory. Therefore, it allows programmers to compile and run programs with much larger memory than the actual system. This allows many large projects to be implemented on systems with limited memory resources. An appropriate analogy is that you don't need a long track to drive a train from Shanghai to Beijing. You only need enough rails (for example, 3 kilometers) to complete this task. The train tracks are immediately placed in front of the train. As long as your operations are fast enough to meet the requirements, the train can run on a complete track. This is the task to be completed for virtual memory management. In the Linux 0.11 kernel, each program (process) is divided into 64 MB virtual memory space. Therefore, the logical address range of the program is 0x0000000 to 0x4000000.
Sometimes we call logical addresses as virtual addresses. Similar to the concept of virtual memory space, the logical address is not related to the actual physical memory capacity.
The difference between a logical address and a physical address is 0xc0000000, because the ing between a virtual address and a linear address is exactly the same. This value is specified by the operating system.
The conversion method from a virtual address to a physical address is related to the architecture. Generally, there are two methods: segmentation and paging. Taking the current x86 CPU as an example, multipart paging is supported. Memory mangement unit converts virtual addresses to physical addresses. The logical address is in the form of segment ID + intra-segment offset. MMU can convert the logical address into a linear address by querying the segment table. If the paging function is not enabled on the CPU, the linear address is the physical address. If the paging function is enabled on the CPU, MMU also needs to query the page table to convert the linear address to the physical address: logical Address ---- (field table) ---> linear address-(page table)> logical addresses with different physical addresses can be mapped to the same linear address; different linear addresses can also be mapped to the same physical address. Therefore, it is a multi-to-one relationship. In addition, the same linear address may be reloaded to another physical address after page feed occurs. Therefore, this many-to-one ing relationship also changes over time. Original address: http://blog.chinaunix.net/u3/90876/showart.php? Id = 2033844

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.