This afternoon I'm working on creating some core virtual machine hard drives with my colleague Pete at Improving. I found this excellent article on creating and optimizing VHDs using differencing. But, it doesn't answer a question I have about sharing base VHDs. My understanding of the NT kernel (the core OS for Windows Server/XP/Vista) is that memory-mapped file IO gives the benefit of only one in-memory copy of any read-only file regardless of how many processes load that file into their working set. I get this idea from Helen Custer's old book on with Windows NT operating system, which I read when it first came out.
So, I have this theory for which I can't find any others confirming or denying. It goes like this:
* Create a base VHD with the core operating system for use in multiple machines (a la the article).
* Mark the base VHD read-only.
* Create a new VPC/Virtual Server/VM using a differencing file on the base VHD.
* Create a second VM using a second differencing file on the base VHD.
* Start both VMs at once. The base VHD should only physically be loaded into physical RAM once! The physical memory of the file will be logically mapped into each of the VM processes, but won't consume any more physical or paged memory on the host machine.
I guess I have to actually run the experiment to prove this as no one I can find seems to be thinking about this memory-mapping concept enough to make a statement one way or another. Google has failed me. :(