Two Processes in Virtual Memory

2019-09-06 11:27发布

I have read about virtual memory . I have a doubt .Suppose there are two processes P and Q . Both will have same virtual memory addressing . They both have their page tables . There will be a system wide page table .then how are these two processes distinguished on RAM if we use a system wide page table ?

3条回答
Fickle 薄情
2楼-- · 2019-09-06 12:02

It is because virtual address is split into user and kernel space. After boot process is started, paging unit is enabled which suddenly jumps into kernel space virtual address and finally it passes the control to user space. System wide page table is for kernel and each process has its own page table.

When it runs into kernel it uses kernel page table and when switched back to user, it uses user process page table.

Each process has its own page table and thus it differentiate the two process

查看更多
聊天终结者
3楼-- · 2019-09-06 12:12

Each process has a virtual address space which has a mapping to physical memory but then can also be virtualized to, typically, disk.

查看更多
Emotional °昔
4楼-- · 2019-09-06 12:12

If there is a system wide pagetable in use all the time, then that cannot work, as there would be only one virtual mapping and the 2 processes would step on each others memory.

*nix systems however, keep one page table per process(simply speaking) and switches between those when the kernel schedules a process to run. That way each process can have the same virtual addresses mapped to different physical addresses, and there's no problem.

查看更多
登录 后发表回答