0
votes

Does virtual address space resides in virtual memory ? I have a confusion like , Each process has its own virtual memory and page table and conversion to physical address from virtual address takes place while loading it into physical memory , but where does the virtual address space comes into picture ? I have gone through many operating systems books but everywhere it gives just explaination about particular word not where it resides and what is the relationship between them and how it operates. please just explain me theoretically , example not needed. Thanks in advance.

2
An address space is just the set of possible (numerical) addresses. Physical address space is the set of physical-memory addresses, ditto for virtual address space. Processes deal with virtual addresses (on most platforms).Oliver Charlesworth
The virtual address space (of e.g. a process) is just a datastructure (the pagetable) that tells the hardware how to translate memory addresses used when accessing memory to physical memory addresses. The currently active page table resides in physical memory, and it might be changed/switched out to provide another set of mapping whenever desired, such as providing a different set of mappings for each process.nos
What is your practical programming problem? This appears to be a theoretical question, better suited to cs.stackexchange.comRaymond Chen

2 Answers

0
votes

(Virtual) Address space is the set of allowable addresses for a given address width (that is 2^32 bytes on x86, 2^64 on x64). Virtual memory usually means almost the same. It is the set of allowable addresses for a certain process or application or also for the whole system. The virtual memory for a single application can be at most as big as the virtual address space of the system. Each application can "see" only the virtual address space that is allocated to it by the OS (and due to some trickery, it is possible that each application can have a virtual address space of the same size and the sum might be larger than the address space of the system).

Physical memory (more correct: physical RAM), is the amount of effectively installed RAM modules. It is usually smaller than the virtual address space. The OS does swapping to bring the requires memory pages from the hard disk into the physical memory if needed. A memory page in physical memory has a physical address and a virtual one. Normal applications only see the virtual address, and they don't (and must not) care about where the memory page is physically loaded. Therefore an address seen in an application or a debugger is really a virtual address in the virtual address space of that application. The physical address is only ever needed when directly interfacing to hardware. It can even constantly change if the OS decides to do so.

Hope this makes it a bit clearer.

0
votes

I'm not a specialist but i think virtual addressing and paging is a part of the cpu protected mode introduced after 80386 and it is not part of the operating system. The operating system controls the page tables. For the virtual addresses they are just numbers in your executable file for example objdump -d will display them