For a short answer, I can say there is the physical address space (usually a shared one, though in unusual configurations such as NUMA or if you consider the address space visible to e.g. the GPU you can have separate physical address spaces) which represents the actual RAM and also memory mapped I/O ranges for the various devices on your system.
Then there is the virtual address space, which is one layer above the physical one, and you have to do a form of translation (in hardware) from the virtual addresses to the physical addresses.
Pointers in a program hold virtual addresses; as such, pointers with the same value may point to different memory in different processes. Physical addresses are only visible to the operating system….
That translation allows for the OS to do various tricks (demand paging, swapping being the most common ones) which are seamless — barring performance/timing of events — to the process itself. So in short, every process has a separate address space in which its pointers work, and it’s a virtual address space as it’s not representative of the actual physical address space, of actual RAM...
What is the difference between virtual address space and virtual memory?
Virtual Address Space is the collection/range of logical or virtual addresses for a particular process on a computer system. Just to give some insight into virtual addresses -- When the CPU executes our program's instructions, it needs to fetch the instruction, operands/data from main memory (DRAM). Similarly, it also writes the results back to main memory.
When CPU fetches/writes stuff from/to DRAM, it doesn't directly generate the actual physical address of the desired location in DRAM. CPU generates a logical or virtual address which undergoes translation through the joint work done by MMU (hardware) and OS code (software) to get the corresponding physical address.
Virtual Memory is a storage abstraction over DRAM and HDD that can allow the execution of software program whose effective usage/size is more than the size of physical memory. In other words, virtual memory is a technique that does not require the entire program to be present in main memory before the execution begins.
Virtual Memory technique actually uses main memory as a cache of program's pages with unused pages stored on disk blocks. Demand Paging is a way to implement virtual memory where the pages are loaded into memory off the disk as and when they are needed (as a consequence of page faults).
The concept of logical or virtual address space exists whether or not the system implements virtual memory. CPU will still generate virtual addresses that will be translate to corresponding physical addresses, but the entire program needs to be main memory (aka DRAM aka physical memory) if the system doesn't implement virtual memory....