arm - Linux 内核页表拷贝和存储的问题
ringa_lee
ringa_lee 2017-04-17 13:06:35
0
1
363

Linux 内核页表的内容是被所有进程共享的:

  • 那为什么不同进程的内核页表还要单独分配存储空间?
  • 要用深拷贝(memcpy master page table 的内容)而不用浅拷贝(所有进程共享同一份内核页表)的方式?
  • 这样做是出于什么原因考虑?
ringa_lee
ringa_lee

ringa_lee

reply all (1)
黄舟

How to distinguish different processes? When the process forks, the PCB is copied, and the GDT and LDT inside the PCB are copied, and their pointing to the kernel is consistent with the parent process. And the process of forking both the parent process's own LDT and the child process's LDT is set as follows: the parent process forks the child process, the PCB of the child process is basically the same as the parent process, the GDT and LDT are the same at the beginning, but their data The segment is set to read-only. When the parent process (or child process) writes a read-only data segment, an exception occurs and the page table is re-applied, causing the parent and child processes to point to different page tables. All this is based on the principle of lazy memory allocation in Linux itself.

Upstairs, you need to distinguish the address space used by the kernel code and data, the entire memory management method, the process PCB space, and the memory address space applied for by the process.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!