Virtual memory vs. Virtual address space

12,047

The virtual address space is what an individual program sees when it executes. Depending on how the program has been configured this address space will be as large as the maximum the operating system supports.

The operating system kernel is then responsible for mapping addresses in the vas to physical memory, be that RAM, or system page files.

With this design, the programs themselves remain unaware of resources and real addresses, and can operate as if they had all system memory to themselves, or at least the maximum memory a single process can use.

In a nutshell a program works with VAS, and the operating system handles mapping VAS to real storage so that this is invisible to the running program. The running program sees only its VAS.

Share:
12,047

Related videos on Youtube

Karen15
Author by

Karen15

Updated on September 18, 2022

Comments

  • Karen15
    Karen15 over 1 year

    I know virtual memory is a paging file that computer uses to store a part of RAM on hard disk for a running process. But how different is Virtual address space? is it the RAM or hard disk or both?

    • Jamie Hanrahan
      Jamie Hanrahan over 8 years
      Virtual memory is NOT just "a paging file". You're still using virtual memory even if you don't have a pagine file.
    • David Schwartz
      David Schwartz over 8 years
      There are systems with virtual memory and no paging file (such as most SoHo routers) and systems with paging files and no virtual memory (paging files were used on many early computers that had no support for virtual memory). This is common misconception.
  • Andy Dent
    Andy Dent over 8 years
    This is comprehensively wrong.
  • surfasb
    surfasb over 8 years
    2gb of user space only needs 2GB of physical memory. The 2GB limit is so much due to OS design, but more due to the fact that pointers in C/C++ are signed into by default.
  • surfasb
    surfasb over 8 years
    Really? Please explain...
  • Andy Dent
    Andy Dent over 8 years
    The size of a 25GB inbox on disk has nothing at all to do with virtual address space. There's a very straightforward definition of it and I get that you were trying to use an analogy. A lot of people reading your answer, who don't already know what virtual address space is, would not realise it's purely an analogy.
  • Andy Dent
    Andy Dent over 8 years
    "Virtual memory is just the virtual address space that you are using." NO it is not. Virtual address space is the space your program can address in theory, as a combination of the pointer size restrictions and the OS restrictions.
  • surfasb
    surfasb over 8 years
    I think it is a very good analogy considering most people reading the answer are coming from the space of "what does virtual memory and virtual memory address space mean to me as a average user". Now if this is stackoverflow, then this analogy would not suffice and the question itself would need more context. Keep in mind this is Superuser, not Device Driver programmers group.
  • Andy Dent
    Andy Dent over 8 years
    Your analogy doesn't have any boundaries. Virtual Address Space has firm boundaries that are architectural - you can't just buy more RAM or disk space and enlarge the VAS.
  • surfasb
    surfasb over 8 years
    Seriously!? The "25 GB" isn't a boundary?