- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
虚拟内存对我来说是一个相当复杂的话题。我试图理解它。这是我对 32 位系统的理解。示例 RAM 仅为 2GB。我试过阅读很多链接,目前我没有信心。我希望你们帮助我理清我的概念。请承认我的观点,并请回答您认为不对的地方。我的观点中也有一个令人困惑的部分。所以,这里开始总结。
最佳答案
- Does Page table is maintained in Kernel? This VM area struct has a page table ?
vm_area_struct
's(代表抽象的、独立于处理器的内存区域,又名映射),以及一个名为
pgd
的字段,它是指向特定于处理器的页表的指针(其中包含每个页的当前状态:有效、可读、可写、脏等)。
- How MMU cannot find the address in physical RAM. Let's say it translates to some wrong address in RAM. Still the code will execute, but it will be a bad address. How MMU ensures that it is reading a right data? Does it consult Kernel VM area everytime?
- Is the Mapping table - virtual to physical is inside a MMU. I have read it that is maintained by an individual process. If it is inside a process, why I can't see it. Or if it is MMU, how MMU generates the address - is it that Segment + 12-bit shift -> Page frame number, and then the addition of offset (bits -1 to 10) -> gives a physical address. Does it mean that for a 32-bit architecture, with this calculation in my mind. I can determine the physical address from a virtual address.
- cat /proc/pid_value/maps. This shows me the current mapping of the vmarea. Basically, it reads the Vmarea struct and prints it. That means that this is important. I am not able to fit this piece in the complete picture. When the program is executed does the vmarea struct is generated. Is VMAREA comes only into the picture when the MMU cannnot translate the address i.e. Page fault? When I print the vmarea it displays the address range , permission and mapped to file descriptor, and offset. I am sure this file descriptor is the one in the hard-disk and the offset is for that file.
mmap()
操作映射,
execve()
和其他系统调用。
- The high-mem concept is that kernel cannot directly access the Memory region greater than 1 GB(approx). Thus, it needs a page table to indirectly map it. Thus, it will temporarily load some page table to map the address. Does HIGH MEM will come into the picture everytime. Because Userspace can directly translate the address via MMU. On what scenario, does kernel really want to access the High MEM. I believe the kernel drivers will mostly be using kmalloc. This is a direct memory + offset address. In this case no mapping is really required. So, the question is on what scenario a kernel needs to access the High Mem.
- Does the processor specifically comes with the MMU support. Those who doesn't have MMU support cannot run Linux?
fork()
. mmap()
When a program is loaded first the kernel will setup a kernel VM-Area for that process is it? This Kernel VM Area actually holds where the program sections are there in the memory/HDD. Then the entire story of updating CR3 register, and page walkthrough or TLB comes into the picture right? So, whenever there is a pagefault - Kernel will update the page table by looking at Kernel virtual memory area is it? But they say Kernel VM area keeps updating. How this is possible, since cat /proc/pid_value/map will keep updating.The map won't be constant from start to end. SO, the real information is available in the Kernel VM area struct is it? This is the acutal information where the section of program lies, it could be HDD or physical memory -- RAM? So, this is filled during process loading is it, the first job? Kernel does the page in page out on page fault, and will update the Kernel VM area is it? So, it should also know the entire program location on the HDD for page-in / page out right? Please correct me here. This is in continuation to my first question of the previous comment.
readelf --segments
看到)设置多个 VMA(映射),这些段将是文本/代码段、数据段等...在程序的生命周期中,动态/运行时链接器、内存分配器(
malloc()
,也可以通过
brk()
扩展数据段)或直接由程序通过
mmap()
,
shm_open()
, 等等..
Also, I believe this reading from CR, page directory->page-table->Page frame number-memory address this all done by MMU. Am I correct?
关于c - 是否只有在出现页面错误时才会出现虚拟内存区域结构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20041212/
我是一名优秀的程序员,十分优秀!