It's not the applications themselves that control the memory, that's done behind the scenes by the Memory Manager.
The Memory Manager serves physical memory to applications in an address space (virtual memory). Each running application has a 2GB address space, so it believes it has 2GB of memory available to it. The Memory Manager is responsible for how the virtual address space seen by each application is provided with memory, sourced from RAM and the paging file on the hard drive.
Most applications don't need anywhere near this much memory, and only request allocations as they need them. Memory-hog applications, such as Photoshop, immediately allocate as much memory as possible when they start (typically around 1.6GB in Photoshop, according to the settings made). It's evident when you think it through that if two large programs each think they have 2GB of memory to play with, and the computer has, for example, only 2GB of RAM fitted, that at least some of the same RAM has to be being used by each program!
So it's the Memory Manager that decides what is being mapped into a program's address space at any instant and what is being paged out to the paging file on the hard drive, ready to be restored later when it's what the other program will expect to be in its address space.
This is one advantage of a 64 bit OS with at least 6GB of RAM available, but still running 32 bit software. The 64 bit OS can provide 2GB of exclusive physical RAM to two large 32 bit applications without paging. Or if an application is Large Address Aware, such as Photoshop, up to 4GB address space can be made available to it. Using 32 bit Windows with the /3GB startup switch, an app like Photoshop can be supplied a 3GB address space, but at the cost of severely cramping Windows' own operation.
Edited by Platypus, 09 July 2010 - 07:23 AM.