6
votes

From my understanding by reading several articles I assumed Process Address Space(PAS) and Virtual Memory(VM) are same. Is my understanding flawed? Can some one please shed some light on this and en light me? I am confused.

I understand Process Address Space has nothing to do with Ram or Physical memory.

But Just confused about PAS and VM.

1

1 Answers

9
votes

First: "memory" is not equal to "address space". Address space is range of posible addresses. I.e. it's 4 Gb for 32-bit pointers and 16 Eb for 64-bit pointers. On the other hand, memory is... well, memory which you can actually use (at least possibly). So, I bet you're asking if "process memory" is equal to "virtual memory" or if "process address space" is equal to "virtual address space".

Second: Virtual memory is the only memory which you can use in user mode. You can't access physical memory. Physical memory is for kernel mode and drivers. User mode applications work only with virtual memory. Thus, all memory is virtual in user mode. No need to append "virtual". It's by default.

Therefore, "Process Address Space" = "[Virtual] Process Address Space" - i.e. the virtual address space of the single process. The same goes for "memory": "Process Memory" = "[Virtual] Process Memory".

Third: Now, the "Virtual Memory" term usually refer to "System Virtual Memory" (global thing), which is larger than just one process. On the other hand: since addressing is specific to the process there is no such thing as "System Virtual Address Space" (global address space of all processes and kernel).

So, the answer is:

  1. "Process Address Space" = "Virtual Address Space" = "Address Space"
  2. "Process Memory" <> "Virtual Memory"

Examples

For example, the typical limit for process address space is 4 Gb (for 32-bit apps). However, a typical limit of process virtual memory is 2 Gb (which can be expanded up to 3 Gb for 32-bit machines or 4 Gb for 64-bit machines).

On the other hand, the virtual memory is larger than just your process. Consider the case when you allocate memory through CreateFileMapping function. You can create, say, 64 Gb virtual memory block. That's OK even though 64 Gb > 2 Gb. Of course, you can't use all 64 Gb at the same time (because process address space is just 4 Gb), but you can do it in chunks, say, per 512 Mb.

Also, consider the case when you map the same virtual memory block to mupliple locations (multiple addresses).

In other words, one-to-one mapping between virtual memory and virtual address doesn't exist.