Question

I am a little unsure about the physical and virtual address concepts. Here is what I have understood:

The virtual address of the instructions in an already compiled (exe) application file are fixed and when the application begins to be executed, these fixed virtual addresses are dynamically mapped to physical addresses in the memory and the corresponding page table entry is updated.

Can anyone approve whether I am right or not?

Thanks in advance

Was it helpful?

Solution

The virtual address is a layer of abstraction on top of physical addresses. The physical address maps to a specific line in a ram chip. Each process has its own virtual address space, however. The operating system and hardware translate virtual addresses into physical ones at load/store-time.

The same virtual address in two different processes usually is translated into two different physical memory locations. For example, you could write two different programs that both loaded main somewhere near 0x400000.

Even though a 64bit virtual address space is very large and could contain all code and data of all executing programs, you can not find the code and/or data of another process within your virtual address space unless it is mapped by the operating system into multiple processes.

One example is with shared libraries. They are loaded into memory, and the operating system maps the physical memory they reside in into the virtual address space of multiple processes. Another counter-example is IPC shared memory (http://en.wikipedia.org/wiki/Shared_memory).

The page table you mentioned is the mechanism the operating system uses to map virtual memory to physical memory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top