1
$\begingroup$

I have several confusion like :

  1. Does virtual address space resides in virtual memory ?

  2. Does each process has its own virtual address space like each process has its own virtual memory and own page table ?

  3. Mapping to physical address takes place from virtual memory or virtual address space if they are different thing ?

$\endgroup$
  • $\begingroup$ I'm not sure those are different things. Can you have one without the other? $\endgroup$ – Karolis Juodelė Dec 30 '13 at 19:49
  • $\begingroup$ Virtual address space is set of virtual addresses in virtual memory like physical(RAM) addresses are called as memory addresses. $\endgroup$ – user2974606 Dec 31 '13 at 20:36
2
$\begingroup$

A virtual address space maps (addresses) in virtual memory. Typically one uses "virtual memory" when discussing the general concept and "virtual address space" for the concrete instance of a virtual memory.

(Virtual memory may be either relatively fast but expensive physical memory/primary storage [with a simple translation of virtual address to physical address and typically byte-granularity of access] or relatively slow but less expensive secondary storage [which typically involves software "translation", I/O processing, and page-granular access].)

In commonly used OSes, each process (but not necessarily each thread) is given a separate virtual address space, giving each process the illusion that it owns the entire machine's (virtual) memory capacity as if it was running on the computer by itself. Such OSes typically reserve a portion of the virtual address space (usually half) for OS use, in a sense providing the OS with its own address space. (Some earlier ISAs, e.g., Clipper and m88k, provided a separate address space for the OS.) This dedicated OS address range can typically share page tables across multiple processes (and TLB entries by using a global indicator bit). (For x86's hierarchical page tables, the top node cannot be shared since [ordinarily] half of its entries are process-specific. ARM uses separate global and per-process/ASID page table base pointers with indication of how much of the total address range is global.)

(One could consider Address Space IDentifiers as extensions of the virtual address. Segments in Power and Regions in Itanium provide address space extension similar to ASIDs, but apply separate extensions to large sections of the initial untranslated address [e.g., Power uses 256 MiB segments and Itanium provides 8 regions within the 64-bit initial address]. Power actually calls the address types effective [the address computed by the memory access instruction], virtual [the address after the segment translation], and real [i.e., physical].)

On the other hand, a Single Address Space OS shares the entire virtual address space among multiple processes (protection domains). This allows conceptually simple and potentially low overhead communication among processes very much like memory communication among threads within a single process in a more conventional OS. Obviously, in a SASOS a process is not free to use whatever memory address it wants for whatever purpose it wishes; the OS must prevent different processes from using the same address for different storage. This breaks the illusion that the process "owns" the entire machine.

Every virtual address with a valid page table entry maps to a physical address. If the page table entry is invalid, the address does not map directly to a physical address (it may be in secondary storage [e.g., disk] or may not yet be allocated by the process).

(Even the above has simplifications and missing concepts.)

$\endgroup$
  • $\begingroup$ what i understood from above explanation is that like physical memory is named based on address commonly referred as memory address, with the same concept virtual memory also has addresses which are called virtual addresses and complete set of virtual addresses is referred as virtual address space. please correct me if i am thinking wrong ? or my assumtion is correct ? $\endgroup$ – user2974606 Dec 31 '13 at 20:33
  • $\begingroup$ @user2974606 Yes, that is correct. $\endgroup$ – Paul A. Clayton Jan 1 '14 at 18:48
  • $\begingroup$ @PaulA.Clayton So you mean that usually each process has its own virtual address space which is translated to the physical address by using the process's own page table. And sometimes the virtual address space may be global by using inverted page table. Please correct me if I understood it wrong. Thank you. $\endgroup$ – aste123 Dec 29 '16 at 2:07
  • $\begingroup$ @aste123 Using a global address space (SASOS) does not require using an inverted page table; inverted page tables have some advantages under sparse addressing and are less problematic when the page table is shared among multiple processes. One can also have global pages and regions (even outside the OS). E.g., ARM uses a second hierarchical page table to map a global region which can be used by the OS, shared libraries, etc. $\endgroup$ – Paul A. Clayton Dec 29 '16 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.