Home  |  Performance Tips

Virtual PC Performance Tips


Virtual PC Performance Tips

Virtual PC users often wonder how they can get better emulated performance. The following information comes from personal experience, feedback from Virtual PC Central readers, Connectix manuals and web site, and discussions with the authors of Virtual PC.

Hardware Performance Tips

The most important Virtual PC performance factor is the Mac hardware capabilities. The following is a list of hardware considerations to take into account when purchasing a new machine or upgrading your existing Mac. The most important considerations (with respect to Virtual PC performance) are listed first.

CPU Speed

The raw processing power of the main CPU is the most important performance factor. Assuming all other parts of the computer system scale with the CPU speed (including cache and memory speeds), a 500MHz G3 is going to emulate a PC about 20% faster than 400MHz G3.

Level-2 Cache Size & Speed

The “L2” cache is a piece of fast memory that helps reduce the average transfer time between the processor and main memory. Both G3 and G4 processors have “back side” caches which run at a clock frequency that is a small multiple (usually 1-to-1 or 1-to-2) of the CPU clock rate. Virtual PC makes extensive use of the L2 cache because of its relatively large “working set” (i.e. the amount of memory it accesses on a frequent basis). Virtual PC works best with an L2 cache that is at least 512K in size. Most of today’s Macs come with 512K of L2 cache, but older Macs may not.

System Bus Speed

The system bus is the connection between the processor and the main memory. When applications like Virtual PC attempt to access memory, they processor first checks its first-level (L1) cache. If the access “misses” in the L1, the L2 is checked. If the accesses also “misses” in the L2, the access is made across the system bus to main memory. The speed with which this access can be completed is dependent on the speed of the RAM and the clock rate of the bus. Newer Macs have system bus speeds of 75MHz or greater. Older Macs that have been upgraded to G3’s or G4’s may have buses as slow as 40–50MHz.

Memory Size

Virtual PC attempts to use the Mac’s available memory in an intelligent way, maximizing the emulation performance. If there is very little memory remaining for Virtual PC, it will not be able to create a “code cache” of adequate size. The code cache is used to store snippets of code that have been recently translated from x86 to PowerPC.

AltiVec

The G4’s AltiVec unit is used by Virtual PC to speed up certain operations. In particular, AltiVec is used in the emulation of MMX instructions. It is also used to speed up the transfer of pixels to the Mac’s video screen, resulting in a “snappier” feel.

Frame Buffer Access Speed

Most programs on the Mac use a system software service called QuickDraw to draw their graphics to the screen. QuickDraw, in turn, makes use of video acceleration features of the Mac’s video card to speed up drawing operations (e.g. filling in a rectangle with a solid color or drawing a string of text). Because Virtual PC is emulating a video card itself, it doesn’t use QuickDraw to perform each video command. Rather, it performs its own drawing and “blits” (i.e. transfers the pixels) to the Mac’s screen itself. This results in very accurate emulation of the PC’s video, but means that the Mac’s video acceleration features are not used. The important consideration for Virtual PC video performance is how fast the program can access the Mac’s “frame buffer”. The frame buffer is just an area of video memory that the MacOS and programs can use to directly access the pixels on the Mac’s screen. Newer Macs contain on-board or AGP video cards. Some Macs may use PCI-based video cards. Virtual PC can access the frame buffer faster on machines with on-board or AGP cards than it can with PCI cards.

What about MP (multiple processors)?

A number of VPCCentral readers have asked about MP support. Most of Apple’s current high-end line of Macs feature dual G4 processors. Why doesn’t Virtual PC take advantage of this extra hardware? It turns out that MP systems only speed up computing tasks that are “parallelizable” — i.e. they can be broken into pieces that can be executed at the same time. Some operations, such as video compression or graphic editing, are easily parallelizable. Unfortunately, processor emulation is not. The execution of instructions, which make up computer programs, is a serial process. Therefore, there is little benefit to be gained by rewriting Virtual PC to take advantage of MP systems.

Software Performance Tips

Most of the above hardware tips are relatively impractical unless you are considering upgrading or replacing your current machine. This section discusses several software settings that you can easily modify to get the best performance from Virtual PC.

Guest Memory Settings

The “guest” operating system (i.e. the one being emulated) requires a certain amount of memory for adequate performance. The amount of memory various from OS to OS. The following chart lists some basic guidelines for various OSes:

Operating System
Minimum
Memory
Recommended
Memory
MS-DOS
4MB
8MB
Windows 3.1
4MB
8MB
Windows 95
8MB
16MB
Windows 98
32MB
48MB
Windows Me
32MB
64MB
Windows NT 4.0
16MB
32MB
Windows 2000
64MB
128MB
Linux
64MB
96MB

Code Cache Memory

In addition to the PC’s memory, Virtual PC also allocates space for a “code cache”. This space is used to store recently-translated blocks of code. (Translation is necessary because PC code is in x86 machine code, which is not directly compatible with PowerPC processors.) The code cache size is dynamically adjusted based on the code being executed within the PC. For example, most DOS programs require a code cache that is one or two megabytes in size. Windows 95 typically requires about 4 to 6MB. Windows 98 running Internet Explorer or Microsoft Office are much more demanding on the code cache. Virtual PC will allocate up to 27MB of space for the code cache, but only if it find adequate memory in the system.

If your Mac doesn’t have enough memory to allocate space for the PC memory as well as space for a code cache of adequate size, emulation speed will suffer. If Virtual PC isn’t the only program running on your Mac, there will be less memory available for its use.

You can determine how much memory Virtual PC is currently using — and how it is being used — by looking at the “About Virtual PC…” dialog. If you click on the “Info” button, you will see the program’s current memory usage.

If you are running Windows 98 or another “modern” OS, expect that the code cache will be at least 7MB — probably significantly higher. If it is lower than 7MB, there’s a good chance that Virtual PC is unable to allocate additional memory. You should either quit other programs or reduce the PC memory to make more room for code cache space.


Do you have Virtual PC performance tips you’d like to share with other VPCCentral readers? Please email us here.

  Return to Virtual PC Central home page