Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am reading virtual memory and have doubts.

1) How will OS decide, which portion of virtual address to be loaded into physical memory and which not? so that whenever page fault occurs at that time other virtual memory will be loaded.

2) where is page table entry stored for particular process?

3) Two processes (process a and process b) are running in Linux OS. How is OS managing page tables for two processes? So that each process gets different physical address.

4) suppose two processes (process a and process b) are written. in hard disk process a is located at location location_a (virtual address of process a) with size size_a and process b is located at location_b (location_b=location_a+size_a) (virtual address of process a). As these two processes are different in memory location, so these are isolated from each other's memory access. Then How virtual memory is isolating memory to protect memory accessing of other process.

share|improve this question

migrated from Jun 30 '13 at 12:49

This question came from our site for professional and enthusiast programmers.

1) demand paging + LRU 2) It is part of, or linked to the process table 3) physical memory is a resource, it can belong to only one process. (or be on the free list, etc) Just stealing it from one + giving it to the other will do the trick. – wildplasser Jun 29 '13 at 15:57
Excellent idea to renumber your questions. BTW what is a hard disk process ? – wildplasser Jun 29 '13 at 16:11
This question appears to be off-topic because it is about basic (computer architecture) knowledge. – wildplasser Jun 29 '13 at 16:15
Thanks widplasser, But still i have doubts, if you have any good link about paging and virtual. Please tell me. – Embedded Programmer Jun 29 '13 at 16:44
GIYF: – wildplasser Jun 29 '13 at 16:58
  1. The OS brings pages into memory on demand. Which is why it's called demand paging. If a process accesses a page that is not currently in memory, a page fault occurs, which causes the pages to be brought into memory. Conversely, if there is pressure on memory, pages are ejected from memory (mostly LRU).
  2. Page table entry is linked to the process data structure inside the kernel. See here for Linux.
  3. OSes that implement virtual memory, use a MMU (memory management unit) to do the virtual memory to physical memory translation. MMU is a piece of hardware that is programmed by the OS for the required page mappings for a process. After the MMU has been setup, the accesses to virtual addresses are automatically directed to the right physical addresses.
  4. See 3 above. Even though the virtual addresses are the same, they are mapped to different physical addresses by setting up the page tables (and MMU) appropriately.
share|improve this answer

You must log in to answer this question.