How OS determines size of virtual memory
===

I am very much confused about the `allocation of virtual memory to a process`.

**How does the OS determines the size of `virtual memory` which should be assigned to a process?**    
**Does it depend on the process size?**    
**Does it depend on the size of the RAM(`main memory`)?  If yes, then suppose size of the RAM is 4GB, & resident OS takes 1GB for its execution, now how much virtual memory will be assigned to a process?**     