What is the 'Code Cache' under Virtual PC?

What is the 'Code Cache' under Virtual PC?

  • Comments 2

Under Virtual PC you can view the 'properties' of a running virtual machine.  One of the bits of information that we display is a breakdown of the memory usage - into main memory, video RAM and code cache.  The other day some one asked me what 'code cache' meant - so here goes:

When we can't execute code directly on the processor (aka 'virtualization') we have to fall back to a binary translation engine (aka 'emulation') in order to provide the best performance possible this translation engine keeps a 'code cache' of recently translated code so that it can be reused (this essentially serves the same purpose as a physical cache on a processor).

Now - for operating systems with Virtual Machine Additions installed - the code cache should remain fairly small (~3-8mb) but on virtual machines without Virtual Machine Additions this can get quite large.  If I remember properly it is capped at 15 MB.

Now - the code cache is allocated dynamically (in fact it is the largest chunk of memory that Virtual PC allocates dynamically - generally we try to lock things down at power up).  The code cache is allocated dynamically because we do not know how much we will need ahead of time.  Having said that - if you are running your system tight on memory - not having sufficient space for us to expand our code cache is not a fatal problem.  It just means that the virtual machine might run a little slower than it could do.

Cheers,
Ben

Leave a Comment
  • Please add 5 and 7 and type the answer here:
  • Post
  • Does that mean that when we get to run virtual pc on new processors that support virtualization, this code cache no. is going to reduce further ?
  • The code cache will be used less - but there still remain a couple of interesting corners of the architechture where we will still need to use an emulator.

    Cheers,
    Ben
Page 1 of 1 (2 items)