The reason launching programs in the VM causes the swap files to be used is because there is too much stuff trying to be in memory on the host. I know you've said the host is using less than 3GB, but that seems like only part of the story, and it may be the host is severely limiting itself due to the massive allocation to the guest VM. Before switching on the guest VM and after letting the host do whatever else it normally does for at least 20 minutes what is the available and cached memory listed as in task manager performance tab?
To increase overall performance, I would reduce the amount of RAM allocated to the VM to about 6GB, to allow the host to have more frequently used data in RAM. I know this sounds counter-intuitive but this will let the guest VM know that there isn't as much RAM available in the whole system and so it will be more frugal in its RAM usage so when it uses the mentality of "all ram should be used for something" it is not filling the host ram with useless garbage because the guest vm no longer thinks there is plenty of ram. Reducing the guest VM ram allocation will mean that the host won't have to use hdd swap space to provide the vm its full ram allocation. Note that the processes tab in task manager has many different "memory" classifications available in the view->select columns screen.
I find that when task manager reports that cached memory is low, this is a cause and effect of the whole system being slow. For my usage patterns on an 8GB machine I find that if the machine is running with less than 33% of its physical ram as cache it is intolerably slow. So for you I'd round that up to 6GB for cache 6GB for the VM and 4GB for the host. You may find that the guest VM needs to have its ram reduced even further due to the ram requirements on the host, though don't go too far or the guest VM will be using its swap file too much. Having adequate cache is a must for performance, for both guest VM and host. Though I have noticed the 32gb remote desktop server at work gets by with only 4-6GB of cache.
In windows task manager
- Total memory = physical ram that windows can use (some hardware can use/share physical memory like some graphics hardware)
- Cached memory = stuff windows has in ram just in case something needs it, plus stuff that it needs to finish writing to the hdd.
- Available memory = what you should consider as usuable
- Free memory = wasted memory that is currently used for nothing. You should ignore this value, unless it stays a big number, then windows is broken. It should slowly decrease as more and more ram is made useful.
There are some relationships between them, particularly if you delve into the details available from the resource monitor and/or the MS Sysinternals utility RAMmap.
- Taskmanager cached = resource monitor standby + modified
- Taskmanager Available = resource monitor standby + free + zeroed
- Taskmanager free = resource monitor free + zeroed
It is important to understand that standby memory can be immediately discarded and reused for something else, which is why it is considered as available. If windows is doing nothing else, and there is free and/or zeroed ram it will slowly read stuff from the hdd in to the cache and mark it as standby memory. This makes the ram useful for something instead of just being wasted.
All OS developers should rename the "free ram" metric to be "wasted ram"
As you open programs on either the guest or host OS, the host OS needs to open files or parts of files from the hdd. Note that the guest hdd is a file on the host machine, that gets read from and written to by the host process that runs the VM. The host OS will cache that information as it is read, and if there was still wasted (aka free) memory on the host it will be kept in memory as standby data. Also note that the cache system does not have to cache a whole file, it can cache just parts of it, this is how an 80GB+ file can have parts of it in the 16gb of ram that the host has.
The host and guest OSes balance what memory programs are wanting to allocate with providing cached data of the files on the hdd. Often, programs allocate some memory that they need very rarely, while they make frequent demands of the files on the hdd. The OS uses the swap file on the HDD to store that infrequently used program info in, so it can have more ram available for caching files. The only way the OS can decide what to have in RAM and what to leave on the HDD is with statistics of how often that piece of info is requested or written to. This includes parts of the VM hdd file that the host OS may want to cache.
If your VM needs to use files from its vhdd, like opening programs, that translates to the host os having to read/write from/to the file that contains the vhdd. If the guest VM is busy this makes the host machine busy too.