What's the frequency of the letter "r" in:
Q: Wastage of resources in Virtualization I have asked this question on SO, but was suggested that i ask it here on SF, so here it goes.
https://stackoverflow.com/questions/3010753/wastage-of-resources-in-virtualization
I am not sure if this is the right place to ask the question. However i hope it is.
When looking for a VPS earlier today, I was trying to understand how each container would work in the background. Keeping in mind the fact that the operating system uses most of the memory and power on a system, wouldn't having multiple operating systems in the same machine mean more wastage of resources.
For instance if i was running centOS on a dedicated box and it was running lets say 20 background OS level processes. Then i go and install a virtualization platform and install 5 more centOS virtual machines in the same system which are exactly the same as the host operating system. Doesn't this mean duplication of those 20 processes 6 times? So internally the context switching is happening between 120 processes instead of 20?
Further Notes:
Here is an example of what i am thinking: I have a master-slave configuration for a long running, cpu + memory intensive process, which can be distributed to 4 machines. Lets say when the process runs on these 4 machines with lets say 1 Gh CPU and 1 Gig RAM, i get 400 results per hour from the cluster (assuming 100 results from one machine) . Now i get a bigger machine ( lets say 4Gh and 4 Gig RAM), have 4 virtual hosts on it with 1 Gz CPU and 1 Gig RAM. Will this configuration give me the same 100 results per hour from these 4 virtual hosts? 

A: Firstly, "the fact that the operating system uses most of the memory and power on a system", that's far from a fact, very far for most servers actually.
But to answer your question yes it does mean all those processes are going on, but the idea is that with today's multi-core CPUs a single OS can hardly every use all available resource, so why not use it to virtualise. If you have a single old CPU then sure it'll slow everything down but that's not what happens in the majority of cases.

A: Most processes in the guest machines will be in sleep state almost the whole time. You can check how much processes sleep with the ps command. On modern hypervisors, duplicate memory pages are shared between virtual machines with a technique called KSM on Linux. VMware has the same thing. Not sure about Hyper-V these days.
All in all, virtualization has overhead, but not as much as you think.

A: I see the part of your question pertaining to OS footprint was already answered back at SO, so I'll only go into the performance considerations here.
You will not get the exact same level of performance. However, I can't tell you with certainty if the performance is going to be better or worse. 


*

*Yes, even with the today's state-of-the-art hardware and hardware assisted virtualization, there is still a certain amount of overhead incurred. However, this overhead is getting smaller by the day and may already be negligible for a given use.

*On the other hand, following your example of four machines running a distributed process, there are many more variables that might affect performance. For example, it might be that the four nodes need to communicate heavily with each other about what they're doing. In that case, you might see the speed and response time of those communications rise if the four machines run on one hardware machine (using some kind of inter-VM network communication). And that could increase the performance of the overall process.

*To give another example, let's assume the process is very network-intensive. If you have four physical machines running the process, they will all have their own network interface card. But if you have four VMs running on one server (assuming the server has only one NIC), the VMs will need to share a single NIC. Given equal bandwidth per NIC in both cases, this would decrease performance.
In short: it basically all depends on the available resources, and how heavily each type of resource is being used.

user
In that passage, there are two hundred occurrences of the letter "r."
assistant