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 ?Answer1:
Each process has a virtual address space which has a mapping to physical memory but then can also be virtualized to, typically, disk.Answer2:
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 processAnswer3:
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.