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?
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.
Virtual address space is what the process sees. For example, your email sits in an inbox that is, say, 25GB in size. That is your virtual address space.
Virtual address space is to distinguish the fact that not every virtual address space corresponds to a physical address space. Lets say you have 20 email users with 25GB of inbox space. But you only have 100GB of disk space on your server. Well, you can take old emails and archive them and only keep the recent ones on your server because people usually only check the most recent email.
Archiving email from the server to, say, a tape drive is akin to the computer paging parts of RAM to disk. When someone goes to look at old email, you just "page" the old email from the tape back onto your server. The email user will never know the difference.
In the same way, each process on your machine has X virtual address space, even though you may have less than
Virtual memory is exactly that. Virtual address space. But virtual memory is just the virtual address space that you are using.