The MED-V Blog

The Microsoft Enterprise Desktop Virtualization blog.

How MED-V V2 Manages Memory of Virtual PCs

How MED-V V2 Manages Memory of Virtual PCs

  • Comments 1
  • Likes

The MED-V Host Agent controls how memory is allocated to the underlying VPC. This memory can be controlled either dynamically where the memory is allocated a certain amount based on host memory configuration or set using a static value.

Dynamic Memory

Dynamic memory is the default configuration. The following registry key is used to toggle this configuration on or off.

  • Path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Medv\v2\VM or HKEY_CURRENT_USER\Software\Microsoft\Medv\v2\VM
  • Value: HostMemToGuestMemCalcEnabled
  • Data Type: DWORD
  • Default: 1           

When enabled, the memory allocated for the guest is not calculated from the memory present on the host based on upon a matrix. If not enabled, the static value is used.

The dynamic memory matrix is based on ranges determined in the HostMemToGuestMem and GuestMemFromHostMem registry values (found in the same registry paths as above.)

  • HostMemToGuestMem: This is a REG_MULTI_SZ value that determines the host range for the dynamic memory matrix. Possible values can be from 1024 to 16384.
  • GuestMemFromHostMem: This is a REG_MULTI_SZ value that determines the guest range for the dynamic memory matrix. Possible values can be from 128 to 3712.

For example, when the following registry settings are configured . . .

-          HostMemToGuestMem: 1024, 2048, 4096, 8192, 16384

-          GuestMemFromHostMem: 256, 512, 1024, 2048, 3072

. . . the memory settings will follow these guidelines:

If Host Memory is . . .

Then Guest memory will be . . .

1024

256

2048

512

4096

1024

8192

2048

16384

3072

 

Static Memory

You can bypass dynamic memory and set the memory using a static value by creating a DWORD value called Memory in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Medv\v2\VM.

-          Value: Memory

-          Data Type: DWORD

-          Default: 512       

This setting is ignored if the HostMemToGuestMemEnabled setting is enabled. If this setting is NOT there and the HostMemToGuestMemEnabled is disabled then the default will be 512 MB. The range for this value can go from 128 MB to 3712.

Issues

It will require the MED-V International patch to use any memory values over 2048 for either static or dynamic memory. If you are finding that the settings are not exceeding 2048, please make sure this patch has been applied. You can download the MED-V International patch here:

http://www.microsoft.com/download/en/details.aspx?id=6590

Be careful when Testing Memory Settings

Never use the Virtual PC console when testing memory settings. When MED-V is deployed, even though the VPC console shows the workspace as a registered VPC, you will still not be seeing an accurate view of what MED-V is using for memory. MED-V overrides internally what is set in the VPC console.

For example, here the VPC for XP Compatibility shows 2048 GB in the Virtual PC window. MED-V will register the Virtual PC with its default settings based on the VMC configuration – however – the memory configuration will be overridden by whatever memory settings have been configured under the MED-V Host Agent.

 

To test what MED-V has as the memory set for the VPC used by MED-V, it is recommended to either display MED-V in MED-V’s full-screen diagnostic mode (by running the command MEDVHOST /FullScreen) or test in its deployed mode (seamless mode) by using a pre-published command prompt to serve as a “jumping-off” point for testing.  

For example, in this scenario, I will launch a command prompt from XP using the same VPC.

Once this command prompt is launched, I will then launch “Control” and then from the Windows XP Control Panel, I will click “System.”

In this dialog box, I see that actually only 512 MB of RAM has been allocated to the VPC.

 

In order to change this, I would need to either:

-          Adjust the matrix used to govern Dynamic Memory (Host-to-Guest Memory Calculation.)

Or

-          Disable MED-V Dynamic Memory (Host to Guest Memory Calculation) and set the memory using a static value.

This will require both the Guest OS to restart as well as the MED-V Host Agent. This is often missed as the default action for closure on the MED-V workspaces is often set to hibernation. One way to ensure both the workspace and the host get properly reset would be to restart the MED-V host agent and then force a restart of the workspace. The command “Shutdown –r” will trigger this within the workspace.

Once the MED-V Host Agent and Workspace have full restarted, you can test the memory allotment using the method above or just simply run the following command from the pre-published Windows XP command prompt:

WMIC PATH Win32_OperatingSystem GET TotalVirtualMemorySize.

 

When it comes to performance baseline testing with memory configurations, always test memory configuration changes using seamless mode. It's the only thing MED-V overrides.

Please note, these values (listed above) could be either in the registry's machine path (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Medv\v2\) or the user's path (HKEY_CURRENT_USER\SOFTWARE\Microsoft\Medv\v2\.) Either way way is acceptable however, it is important to review how MED-V uses the following search path when looking for the resultant settings values:

  • MED-V first looks in the machine policy.
  • If the value is not found, MED-V looks in the user policy.
  • If the value is not found, MED-V looks in the HKEY_LOCAL_MACHINE\System hive.
  • If the value is not found, MED-V looks in the HKEY_CURRENT USER registry hive.
  • If the value is still not found, MED-V uses the default.
Comments
  • I will also point out that use of the /3GB switch in the boot.ini configuration of the workspace, will in fact, allow the user memory space to use the additional space - but bear in mind we have also seen some negative performance effects with the reduction of the kernel space in virtual PCs.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment