Hi.If a page pointed by a poiner is paged out and again paged in to a different location,then how the pointer keeps track of it?Has it something to do with virtual memory?Please explain in details.
Jerico
Yes, it has. In general, in systems that support virtual address spaces programs only know virtual addresses. These are translated by the MMU (memory management unit) to hardware (physical) addresses. If memory pages are paged out and in again, the MMU keeps track of this. The programm still uses the same virtual addresses, but the mapping to physical addresses may has changed. Things may differ from system to system, but the virtual address is typically divided into a page offset (e.g. for a page size of 4kB page the lower 12 bits) and a virtual page number (upper bits). The latter is translated to the physical page number.
Hope that helps as a starting point. You may find more information on this in all books on computer architecture (Hennessy/Patterson or Tanenbaum, for instance).