Does Virtual Memory area struct only comes into picture when there is a page fault?

前端 未结 2 734
陌清茗
陌清茗 2021-02-04 17:20

Virtual Memory is a quite complex topic for me. I am trying to understand it. Here is my understanding for a 32-bit system. Example RAM is just 2GB. I have tried reading many li

2条回答
  •  佛祖请我去吃肉
    2021-02-04 17:59

    Though this is not going to be the best answer, iw ould like to share my thoughts on confused points.

    1. Does Page table is maintained...

    Yes. kernel maintains the page tables. In fact it maintains nested page tables. And top of the page tables is stored in top_pmd. pmd i suppose it is page mapping directory. You can traverse through all the page tables using this structure.

    2. How MMU cannot find the address in physical RAM.....

    I am not sure i understood the question. But in case because of some problem, the instruction is faulted or out of its instruction area is being accessed, you generally get undefined instruction exception resulting in undefined exception abort. If you look at the crash dumps, you can see it in the kernel log.

    3. Is the Mapping table - virtual to physical is inside a MMU...

    Yes. MMU is SW+HW. HW is like TLB and all. The mapping tables are stored here. For instructions, that is for code section i always converted the physical-virtual address and always they matched. And almost all the times it matches for Data sections as well.

    4. cat /proc/pid_value/maps. This shows me the current mapping of the vmarea....

    This is more used for analyzing the virtual addresses of user space stacks. As you know virtually all the user space programs can have 4 GB of virtual address. So unlike kernel if i say 0xc0100234. You cannot directly go and point to the istruction. So you need this mapping and the virtual address to point the instruction based on the data you have.

    5. The high-mem concept is that kernel cannot directly access the Memory...

    High-mem corresponds to user space memory(some one correct me if i am wrong). When kernel wants to read some data from a address at user space you will be accessing the HIGHMEM.

    6. Does the processor specifically comes with the MMU support. Those who doesn't have MMU support cannot run LInux?

    MMU as i mentioned is HW + SW. So mostly it would be coming with the chipset. and the SW would be generally architecture dependent. You can disable MMU from kernel config and build. I have never tried it though. Mostly these days allthe chipsets have it. But small boards i think they disable MMU. I am not entirely sure though.

    As all these are conceptual questions, i may be lacking some knowledge and be wrong at places. If so others please correct me.

提交回复
热议问题