What is "memory priority" when service pack 1 is installed?

After installing the service pack 1 beta on Windows Server 2008 R2 you will see that virtual machines have a new setting for memory.  The Memory priority:

Capture6 - Copy4

This setting is part of the new dynamic memory feature.  And there is a lot to learn about it.

The first thing to know is that this setting does not have any real effect if there is enough memory available on the physical computer.  With enough memory available in the physical computer – all virtual machines can get the amount of memory that they want.  However, when there is not enough memory available in the physical computer, Hyper-V needs to decide who gets the memory and who does not.  And this is where the memory priority comes in to play.

Specifically there are three effects:

  1. Higher priority virtual machines get given more memory.  When memory is being given to virtual machines it is given to high priority virtual machines first.
  2. Memory is taken from lower priority virtual machines first.  Similarly to the first point – when more memory is needed, it is taken from low priority virtual machines before it is taken from high priority virtual machines.
  3. The amount of memory removed from already running virtual machines when trying to start a new virtual machine depends on the memory priority of the new virtual machine.

There is some extra information to know about this third point.

The first is that – yes – Hyper-V will take memory away from already running virtual machines in order to let a new virtual machine start.  That is unless the new virtual machine has a very low memory priority.  The second is that this “startup effect” of memory priority also applies to virtual machines that do not have dynamic memory enabled. 

This is to say that if you have a mixture of virtual machines with and without dynamic memory enabled – the memory priority setting on the virtual machines without dynamic memory enabled will affect how much memory is removed from the dynamic memory enabled virtual machines when you try to start the virtual machines without dynamic memory enabled.

Cheers,
Ben