Development with VMware

From KoanSoftware Wiki
Jump to: navigation, search

VMware

Because virtual machines work by time-sharing host physical hardware, a virtual machine cannot exactly duplicate the timing behavior of a physical machine. VMware virtual machines use several techniques to minimize and conceal differences in timing behavior, but the differences can still sometimes cause timekeeping inaccuracies and other problems in guest software.

This problem occurs because current VMware for Linux products do not have complete support for host power management features (such as Intel SpeedStep, or AMD PowerNow or Cool'n'Quiet) that vary the processor speed. To work around this problem, specify the correct maximum CPU speed in your global configuration file. This can be done on either a Windows host server or a Linux host server.


On a Linux host server

To prevent guest clocks from running too quickly, specify the correct maximum host CPU speed in your global configuration file, /etc/vmware/config. If this file exists, edit it with a text editor, adding the lines described below. The file may not exist. If it does not exist, create it as a plain text file.

Add the following lines to your global configuration file:

 host.cpukHz = "X" where "X" equals the maximum speed in KHz of your host machine.  
               That is, its speed in MHz times 1000 or its speed in GHz times 1000000.  A 3GHz machine would be 3000000.
 host.noTSC = TRUE
 ptsc.noTSC = TRUE

To periodically correct the time (once per minute) when a guest clock runs slowly, VMware Tools must be installed in the guest. On the Options tab of VMware Tools in the guest, verify that Time synchronization between the virtual machine and the host operating system is selected.


On a Windows host server

Find the speed of your host's CPU. For example, in Windows XP, right click My Computer, then choose Properties. This path may be different, depending on the version of Windows you use.

Look for config.ini in one of the following locations:

C:\Documents and Settings\All Users\Application Data\VMware\VMware Workstation\config.ini

C:\Documents and Settings\All Users\Application Data\VMware\VMware GSX Server\config.ini

C:\Documents and Settings\All Users\Application Data\VMware\VMware Server\config.ini

C:\ProgramData\VMware\VMware Workstation or
C:\Program Files\VMware\VMware Workstation
(on a Windows Vista host running Workstation 6.0)

Edit config.ini, adding the lines described below.

host.cpukHz = "X" where "X" equals the maximum speed in KHz of your host machine.  
              That is, its speed in MHz  times 1000 or its speed in GHz times 1000000.  A 3GHz machine would be 3000000. 
host.noTSC = "TRUE"
ptsc.noTSC = "TRUE"

The second and third lines enable a mechanism that tries to keep the guest clock accurate even when the time stamp counter (TSC) is slow.

Note: On Windows, you can use Notepad, but be careful when you save the file that Notepad does not add an extra .txt extension to the filename. You can do that by selecting All files instead of Text files in the Save dialog box.

In addition, check the VMware Tools control panel in the guest operating system. On the Options tab, ensure that Time synchronization between the virtual machine and the host operating system is selected.