2

I know that if page is not in main memory, CPU will bring it from swap file. So if a virtual address does not have its physical address counterpart in place, CPU will bring it from disk. So mapping to virtual address can be in one of two places: its either in physical memory or in disk. My question is where does virtual address itself reside? Because CPU needs this virtual address in order to perform the mapping. Where does CPU get this address? and when we use gdb to look at virtual address space, where does gdb take all this virutal adresses?

For ex:

Virtual address 0x420000
Page Table 20
RAM 0x800000

Here 20 (Page table entry) resides in RAM. 0x800000 (physical address) resides in RAM. Where does 0x420000 information reside? CPU needs this information from somewhere, otherwise how it would perform address translation?

now I think I know hwere virtual address information comes from. It is come from application program itself from pc counter at which point it passes it to CPU and then CPU does the translation.

  • It doesn't reside anywhere, it is virtual. The only physical manifestation are the page mapping tables maintained by the operating system and the swap file. – Hans Passant Oct 30 '13 at 16:04
  • Where do nonexistent postal addresses reside? They don't. An address does not have a physical existence. It is information that you can use to locate something that *does* exist. A virtual address is simply the information that is used to locate data that has been mapped into the process' address space. The address itself doesn't "reside" anywhere. – jalf Oct 30 '13 at 16:43
  • But you do get postal addresses from somewhere to begin with. Otherwise how else would you locate existence? – Emil Tagiyev Oct 30 '13 at 18:45

1 Answers1

1

The information about virtual pages (their status, physical location etc.) is stored in page table. How the page table itself is implemented and where it is stored depends greatly on the specifics of the OS and underlying hardware support. Even though it might sound tricky at first, the page table itself can even be stored in virtual memory.

AnT stands with Russia
  • 312,472
  • 42
  • 525
  • 765
  • As far as I know, page table ( for a process ) stored in main memory. However, it's supposed to include only page number and page descriptor, not the logical/virtual address. – stdout Aug 14 '16 at 09:43