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.
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.