SYSTEM AND METHOD TO IMPROVE MEMORY USAGE IN VIRTUAL MACHINES RUNNING AS HYPERVISOR GUESTS

A system and method to improve memory usage in virtual machines running as hypervisor guests. In accordance with an embodiment, the invention provides a system for changing the memory usage of a virtual machine on request from a hypervisor, comprising: a hypervisor; a guest operating system executing inside the hypervisor; a communication channel between the hypervisor and the guest operating system; a balloon driver in the guest operating system; a virtual machine for executing a software application; a communication channel between the balloon driver and the virtual machine; a memory space or heap for use by the virtual machine in storing software objects and pointers as part of the software application; and a compacting garbage collector for use by the virtual machine.

Description

COPYRIGHT NOTICE

A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.

FIELD OF THE INVENTION

The invention is generally related to virtual machine environments and other run-time environments, and in particular to memory usage within Java and other virtual machine environments running as guests within a hypervisor.

BACKGROUND

Server virtualization can be used to partition a single physical server into several virtual servers, wherein each virtual server can run its own operating system (OS) and set of applications. The software responsible for managing the virtual servers is generally referred to as a hypervisor. A system administrator can configure the hypervisor to give each virtual server its own share of the physical resources, such as RAM or CPU time. In this manner multiple copies of an operating system think they are each running on their own server, when in reality they are sharing one physical server. An operating system running within a hypervisor is generally referred to as a guest to the hypervisor.

One of the primary uses for virtualization technology is to improve server utilization. A server application running alone on a server seldom makes full use of the server. For example, if two applications that each use 40% of a server capacity could be run on the same server, then only one physical server would be needed instead of two physical servers, with a corresponding reduction of energy consumption and space requirements.

Server virtualization is not needed to aggregate several applications on the same server, so long as the applications all require the same operating system and libraries. Unfortunately, many legacy server applications require different operating systems, or different versions thereof. In these instances the only way to run several of these legacy server applications on the same server is to use a hypervisor to perform server virtualization. In some instances the hypervisor can also provide services that are not normally available in operating systems, such as guaranteeing that a certain amount of the server resources are available to one guest, but not to another less privileged guest. With several physical servers, each running a hypervisor, the hypervisor on one server can move a guest to another server. This can be used to accommodate changes in application workload or necessary upgrades or repairs of servers. Examples of server virtualization technology currently available include VMWare and XenSource.

Since an idling server often uses almost as much energy as a working server (in contrast to, for example, laptops which try to save energy due to battery considerations) aggregating guests can provide substantial energy and space savings, which immediately translates into lower costs. Therefore a common project in many information technology or IT departments is data center consolidation. Data center consolidation is also driven by necessity, for example it is often not possible to add more power to the computer center or there is no more available server space. However in the long term perspective putting old applications and operating systems onto modern hardware using hypervisors is probably not an efficient solution. More intelligent applications that cooperate with the underlying operating system and the hypervisor are needed to fully exploit the data center resources in the future.

In contrast to virtual servers which emulate an already existing hardware design, virtual machines are abstract computers for which application software can be compiled. The virtual machine is thus an abstraction level for application software that is consistent between different hardware and operating system combinations. Most of the complexity in running the same application on different platforms is handled by the virtual machine, and therefore the virtual machine becomes a very complex piece of software. Modern virtual machines need to manage code generation for the particular processor, operating system dependent resources such as threads, networking and file system. The virtual machine also manages the heap, within which allocation and freeing of virtual machine objects is performed. Examples of virtual machines include the Java Virtual Machine (JVM) and implementations thereof, including the JRockit JVM, and the Hotspot JVM. A large portion of today's server applications are written in Java and are executed on such virtual machines. The current trend with data center consolidation requires virtual machines to behave well when run as hypervisor guests, and contribute to the resource savings effort.

SUMMARY

Disclosed herein is a system and method to improve memory usage in virtual machines, or other garbage collected runtime environments, running as hypervisor guests. Current techniques for hypervisor control of guest operating systems severely affect the performance of a virtual machine running inside the guest operating system.

An embodiment of the present invention addresses this problem by providing a system and method to improve memory usage in virtual machines, or other garbage collected runtime environments, running as hypervisor guests. In accordance with an embodiment, a system is provided for changing the memory usage of a virtual machine on request from a hypervisor, comprising: a hypervisor; a guest operating system executing inside the hypervisor; a communication channel between the hypervisor and the guest operating system; a balloon driver in the guest operating system; a virtual machine for executing a software application; a communication channel between the balloon driver and the virtual machine; a memory space or heap for use by the virtual machine in storing software objects and pointers as part of the software application; and a compacting garbage collector for use by the virtual machine.

In accordance with another embodiment, the balloon driver can control the heap size of the virtual machine using the balloon driver to virtual machine communication channel.

In accordance with another embodiment, the hypervisor can divide available physical RAM evenly or in a specified proportion between the virtual machine heaps.

In accordance with another embodiment, the hypervisor can set different heap sizes for different virtual machines to guarantee conformance to service level contracts which are different for each virtual machine.

In accordance with another embodiment, the operating system can be specifically tailored to run only a single virtual machine with no swapping and no other user processes.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 shows an illustration of a system in accordance with an embodiment that improves memory usage of virtual machines running as guests within a hypervisor.

FIG. 2 shows a schematic of the memory layout in accordance with an embodiment, illustrating the Java heap before and after the heap size has been reduced.

FIG. 3 shows a schematic of the memory layout in accordance with an embodiment, illustrating when two OS/JVM guests are running within a hypervisor.

FIG. 4 shows a schematic of the memory layout in accordance with an embodiment, illustrating when a third OS/JVM guest has been added to the hypervisor.

FIG. 5 shows a flowchart in accordance with an embodiment, illustrating the reallocation of hypervisor RAM.

DETAILED DESCRIPTION

Server virtualization can be used to partition a single physical server into several virtual servers, wherein each virtual server can run its own operating system (OS) and set of applications. The software responsible for managing the virtual servers is generally referred to as a hypervisor. A system administrator can configure the hypervisor to give each virtual server its own share of the physical resources, such as RAM or CPU time. In this manner multiple copies of an operating system think they are each running on their own server, when in reality they are sharing one physical server. An operating system running within a hypervisor is generally referred to as a guest to the hypervisor.

One of the primary uses for virtualization technology is to improve server utilization. A server application running alone on a server seldom makes full use of the server. For example, if two applications that each use 40% of a server capacity could be run on the same server, then only one physical server would be needed instead of two physical servers, with a corresponding reduction of energy consumption and space requirements.

Server virtualization is not needed to aggregate several applications on the same server, so long as the applications all require the same operating system and libraries. Unfortunately, many legacy server applications require different operating systems, or different versions thereof. In these instances the only way to run several of these legacy server applications on the same server is to use a hypervisor to perform server virtualization. In some instances the hypervisor can also provide services that are not normally available in operating systems, such as guaranteeing that a certain amount of the server resources are available to one guest, but not to another less privileged guest. With several physical servers, each running a hypervisor, the hypervisor on one server can move a guest to another server. This can be used to accommodate changes in application workload or necessary upgrades or repairs of servers. Examples of server virtualization technology currently available include VMWare and XenSource.

Since an idling server often uses almost as much energy as a working server (in contrast to, for example, laptops which try to save energy due to battery considerations) aggregating guests can provide substantial energy and space savings, which immediately translates into lower costs. Therefore a common project in many information technology or IT departments is data center consolidation. Data center consolidation is also driven by necessity, for example it is often not possible to add more power to the computer center or there is no more available server space. However in the long term perspective putting old applications and operating systems onto modern hardware using hypervisors is probably not an efficient solution. More intelligent applications that cooperate with the underlying operating system and the hypervisor are needed to fully exploit the data center resources in the future.

In contrast to virtual servers which emulate an already existing hardware design, virtual machines are abstract computers for which application software can be compiled. The virtual machine is thus an abstraction level for application software that is consistent between different hardware and operating system combinations. Most of the complexity in running the same application on different platforms is handled by the virtual machine, and therefore the virtual machine becomes a very complex piece of software. Modern virtual machines need to manage code generation for the particular processor, operating system dependent resources such as threads, networking and file system. The virtual machine also manages the heap, within which allocation and freeing of virtual machine objects is performed. Examples of virtual machines include the Java Virtual Machine (JVM) and implementations thereof, including the JRockit JVM, and the Hotspot JVM. A large portion of today's server applications are written in Java and are executed on such virtual machines. The current trend with data center consolidation requires virtual machines to behave well when run as hypervisor guests, and contribute to the resource savings effort.

Java Virtual Machine Memory Usage

A Java program works on data structures referred to as Java objects, which in turn are stored in the Java heap. The Java heap is an area of the available memory that is reserved for Java objects only. New objects are created in the Java heap, and when there is no more space left in the heap, a garbage collection process is used to identify objects that are no longer in use and the corresponding memory can then be reclaimed and used for new Java objects. The definition of the Java Virtual Machine does not specify any requirements on the performance or the behavior of the garbage collection process other than basic assumptions such as: unused memory should be reused for new objects, and finalizers should be called when objects are to be released. Additional information about the Java Virtual Machine is provided in “The Java Virtual Machine Specification (2nd Edition), 1999”, by Tim Lindholm and Frank Yellin, incorporated herein by reference. The JVM implementer can therefore choose to optimize different kinds of behaviors, depending on the requirements of the application software and the features of the particular hardware used. A perfect garbage collector would be undetectable to the application software and the software user, in that there would be no pauses, no extra CPU or memory consumption. Unfortunately no such garbage collector exists, and a lot of work has been invested into achieving high performance object allocation and garbage collection with different algorithms for different goals.

In general, a larger Java heap provides better performance because it will take a longer time to fill up the available memory, and there will therefore be fewer garbage collections. The JVM can continue to function as long as the Java heap is slightly larger than the application size. The application size is also referred to as the live data size, and is simply the sum of all objects known to be live after a garbage collection. The application size cannot exceed the maximum size of the Java heap. If the application tries to exceed this limit then a fatal out-of-memory error is thrown and the JVM terminates.

With an application size that is almost the same as the Java heap size the JVM will spend most of its time garbage collecting, and the application performance will be very low. If the Java heap is twice the application size then the performance impact of garbage collection is usually reasonable or even low.

Operating System Memory Usage

Swapping is a proven operating system technique to allow allocation of more RAM than a server physically has available. The general idea of swapping is that if one process does not currently access an area of its RAM, then the operating system can instead store the contents of that area on disk, and give the memory to another process that needs memory more urgently. If the original process later tries to access that area of memory again, the operating system has to load it from disk into memory again. (If the operating system is out of memory when the request happens, it may have to first swap out some other memory to disk to complete the request). In theory and practice, swapping works well in a multi-process operating environment for many types of processes. Hardware and operating system software have been designed and optimized for a long period of time to perform swapping efficiently, and applications often have code and data that are more seldom used than other parts of the same application.

Efficient swapping relies on the existence of areas of memory that are currently not actively used and that will not be accessed soon. These areas of memory may contain important data, wherein that data is currently not accessed, but in some distant future may get accessed. Successful swapping relies on the system's ability to find these inactive memory areas. They stand in sharp contrast to the active memory areas, as these are frequently accessed by the process. If most of the memory areas are active, then the system will be unable to find sufficient number of inactive areas to swap out, and will have to swap out some active areas. This swapping will result in severe performance degradation, since pages have to be stored to disk and immediately brought back in RAM.

Hypervisor Swapping of Virtual Machine Memory

A hypervisor can decide to swap out pieces of a virtual machine, in the same way as an operating system can decide to swap out pieces of processes, to provide room for other virtual machines that have more need for memory. Moreover, in the same way that operating system swapping is transparent to a process inside the operating system, hypervisor swapping is transparent to an operating system inside a virtual machine. The swapping process is transparent to the guest operating system, apart from that the operating system may detect that it sometimes runs slower. The operating system itself cannot detect that parts of it are swapped out. Since the whole operating system runs slower, the processes inside the operating system will also run slower.

The reason for the hypervisor to swap out pieces of a virtual machine's memory is generally the same as for the operating system to swap out pieces of a process's virtual memory, i.e., there is a fixed amount of physical RAM and the hypervisor tries to share these resources between the guests in the most efficient way.

Successful, efficient swapping is highly dependent on which pages (pieces of memory) are picked to get swapped out. Ideally, the pages that will be used furthest into the future should be selected. Such an algorithm would be difficult to design, but fairly good approximations exist for operating system swapping. For hypervisors the problem is more complicated. If the hypervisor used the same swapping algorithm as the guest operating system then the hypervisor and the guest operating system would want swap the same pages. If the hypervisor swaps the page out first, then it would be likely that sometime soon afterwards the guest operating system inside the virtual machine would decide to swap out the same page. The operating system swap would force the hypervisor to load the page again for the operating system to access so that it can be swapped out again. Clearly, this is not a good idea.

It is better if the guest operating system tries to swap first, and when the operating system has finished swapping out pages, the hypervisor can swap out more if it needs to. This can be accomplished if the hypervisor can trigger the operating system to perform swapping. Legacy operating systems normally have no functionality to receive commands from external software on how they should manage the RAM. Some hypervisors address this problem by inserting a device driver inside the guest operating system that can communicate with the hypervisor. The hypervisor uses a hypervisor to operating system communication channel and tells the driver that it wants the operating system to swap. The driver then allocates non-swappable memory in the operating system. The effect is that the operating system has to swap out other memory. The hypervisor can detect the memory allocated by the driver and avoid allocating RAM for it, thus reducing the total amount of RAM used by the guest operating system.

This type of driver is sometimes referred to as a balloon driver, since the memory allocated by the driver can be seen as a balloon expanding inside the guest operating system and pushing out the processes to swap space. The end result is better performance since the operating system is better suited than the hypervisor to select the best pages to swap to disk.

Unfortunately, a virtual machine such as the JVM with a large garbage-collected heap is very sensitive to swapping. As described above, swapping improves memory usage and has little performance impact as long as the memory usage frequency is non-uniform, i.e. some parts of memory are used more often that other parts. Since the Java heap is fully used before a garbage collection is triggered, the live Java objects are often spread out uniformly over the Java heap. Thus when the garbage collection is performed and the live objects are traced and found, reads must be performed randomly over the whole Java heap during the short period when the garbage collector is active. If the whole heap cannot be kept in memory, (i.e. some parts always have to be swapped out), then the garbage collection trace, which examines in random order most of the Java heap, will cause the garbage collection to slow down, perhaps to an almost complete standstill.

A hypervisor using a balloon driver can therefore not tune the memory usage of a guest operating system running a JVM without severely affecting the performance of the JVM. This is a serious drawback that reduces the efficiency of any garbage-collected virtual machine running in a virtual server environment. Any new technique to improve the memory usage of garbage-collected virtual machines running as guests within a hypervisor would increase the savings generated by server virtualization.

Disclosed herein is a system and method to improve memory usage in virtual machines, or other garbage collected runtime environments, running as hypervisor guests. As described above, current techniques for hypervisor control of guest operating systems severely affect the performance of a virtual machine running inside the guest operating system. An embodiment of the present invention addresses this problem by providing a system and method to improve memory usage in virtual machines, or other garbage collected runtime environments, running as hypervisor guests. An embodiment addresses this problem by providing a system and method to improve memory usage in virtual machines, or other garbage collected runtime environments, running as hypervisor guests. In accordance with an embodiment, the system provides for changing the memory usage of a virtual machine on request from a hypervisor, comprising: a hypervisor; a guest operating system executing inside the hypervisor; a communication channel between the hypervisor and the guest operating system; a balloon driver in the guest operating system; a virtual machine for executing a software application; a communication channel between the balloon driver and the virtual machine; a memory space or heap for use by the virtual machine in storing software objects and pointers as part of the software application; and a compacting garbage collector for use by the virtual machine.

FIG. 1 shows an illustration of a system in accordance with an embodiment that improves memory usage of virtual machines running as guests within a hypervisor. As shown in FIG. 1, the system 101 comprises a server 102 that further comprises a computer hardware 103. The computer hardware is running a hypervisor 104. The hypervisor is running two guest operating systems 105 and 106. Each operating system contains a balloon driver 107 and 108 respectively. The hypervisor controls the memory usage of the guest operating systems using channels 109 and 110 respectively.

In accordance with an embodiment, a first Java Virtual Machine 111 runs as a process within the guest operating system 105. When the application software is running it makes use of the Java heap 112, which contains unused free memory 113 and used memory containing live Java objects 114. The heap is garbage collected by a compacting garbage collector 115. A compacting garbage collector selects an area of the Java heap at each garbage collection, and moves the selected Java objects close to each other, to create large areas of unused memory. The balloon driver 107 controls the memory usage of the JVM 111 using the channel 116.

In accordance with an embodiment, the second guest operating system 106 with its JVM 117 has a smaller Java heap 118 with more unused space 119, and less live data 120. It also has a compacting garbage collector 121. The memory usage operating system JVM 117 is controlled by the balloon driver 108 using the channel 122.

FIG. 2 shows a schematic of the memory layout in accordance with an embodiment, illustrating the Java heap before and after the heap size has been reduced. As shown in FIG. 2, the Java heap 201 contains several Java objects 202 that are randomly spread out over the heap. In accordance with an embodiment, the Java heap is reduced so that the reduced Java heap 206 contains the same Java objects 204, but the objects are instead all moved closer to each other, i.e. they are compacted. This makes possible to remove the end 205 of the Java heap.

FIG. 3 shows a schematic of the memory layout in accordance with an embodiment, illustrating when two OS/JVM guests are running within a hypervisor. As shown in FIG. 3, the hypervisor RAM 301 is being used for two guest OS/JVMs, with Java heaps 302 and 303. The Java heaps also contain Java objects 304 and 305 respectively.

FIG. 4 shows a schematic of the memory layout in accordance with an embodiment, illustrating when a third or subsequent OS/JVM guest has been added to the hypervisor. As shown in FIG. 4, the hypervisor RAM 301 contains two original guests 402 and 403. In accordance with an embodiment the Java objects 404 and 405 in these heaps are compacted to make it possible to reduce 406 their sizes, and to create a new Java heap with the newly acquired memory 407. The new Java heap 407 can then be used by the new OS/JVM guest to store Java objects 408.

FIG. 5 shows a flowchart in accordance with an embodiment, illustrating the reallocation of hypervisor RAM. As shown in FIG. 5, in accordance with an embodiment the process begins at block 501 when the hypervisor decides that reallocation of physical RAM is necessary. In block 502, resize commands are sent to the different guests. In block 503, the guest operating system balloon driver examines the operating system status, to determine if a JVM with a large heap is running. If this is the case, then in block 504 the balloon driver sends a resize command to the JVM. If the JVM has to reduce the size of the heap, then, in block 505, it compacts the heap using a compacting garbage collector to be able to reduce the heap size. If the JVM has to increase the size of the heap, then it can simply increase the heap size. The JVM also reports back this information. In block 506, the balloon driver examines the new status of the operating system. If the JVM resize could not be fully performed, then the balloon driver might have to inflate the balloon anyway, as a final resort. In block 507, the hypervisor memory reallocation is completed when all of the balloon drivers and JVMs have performed their memory usage reallocation and reported back.

As described above, the Java heap size is quite flexible. With a Java heap that is slightly larger than the live data, the garbage collection will be performed often, and will require a large percentage of the available CPU resources. Increasing the Java heap size will immediately lower the number of garbage collections performed, and increase system performance. Embodiments of the present invention as described above make it possible to use the flexibility of the Java heap size to accommodate the needs of several JVMs running within a single hypervisor. With this embodiment, graceful degradation can be achieved when more JVMs are added to the same server. Otherwise, the JvMs might stop working efficiently as soon as the balloon driver forces the guests to swap.

In accordance with another embodiment, the balloon driver can control the heap size of the virtual machine using the balloon driver to virtual machine communication channel.

In accordance with another embodiment, the hypervisor can divide available physical RAM evenly or in a specified proportion between the virtual machine heaps.

In accordance with another embodiment, the hypervisor can set different heap sizes for different virtual machines to guarantee conformance to service level contracts which are different for each virtual machine.

In accordance with another embodiment, the operating system can be specifically tailored to run only a single virtual machine with no swapping and no other user processes.

The present invention may be conveniently implemented using a conventional general purpose or a specialized digital computer or microprocessor programmed according to the teachings of the present disclosure. Appropriate software coding can readily be prepared by skilled programmers based on the teachings of the present disclosure, as will be apparent to those skilled in the software art.

In some embodiments, the present invention includes a computer program product which is a storage medium (media) having instructions stored thereon/in which can be used to program a computer to perform any of the processes of the present invention. The storage medium can include, but is not limited to, any type of disk including floppy disks, optical discs, DVD, CD-ROMs, microdrive, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of media or device suitable for storing instructions and/or data.

The foregoing description of the present invention has been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations will be apparent to the practitioner skilled in the art. Particularly, it will be evident that while the examples described herein illustrate how the features may be used in a JRockit environment, other application servers, virtual machines, JVMs, computing environments, and software development systems may use and benefit from the invention. The code examples given are presented for purposes of illustration. It will be evident that the techniques described herein may be applied using other code languages, and with different code.

The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, thereby enabling others skilled in the art to understand the invention for various embodiments and with various modifications that are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalence.

Claims

1. A system that improves memory usage in virtual machines running as hypervisor guests, comprising:

a computer hardware or machine;

a hypervisor executing on the computer hardware or machine;

one or more guest operating systems executing as guests within the hypervisor, wherein each of the one or more guest operating systems has associated therewith a balloon driver, a virtual machine, for executing a software application, a memory space or heap for use by the virtual machine in storing software objects and pointers as part of the software application, and a garbage collector for use by the virtual machine in garbage collecting of software objects within the memory space or heap; and

wherein the system receives information about the usage of the memory space or heap by the virtual machine, and uses the balloon driver to control the use of the compacting garbage collector and to manage the memory space or heap size as necessary for use by the one or more guest operating systems executing as guests within the hypervisor.

2. The system of claim 1, further comprising:

a plurality of guest operating systems executing as guests within the hypervisor;

a communication channel between the hypervisor and each of the plurality of guest operating systems executing as guests within the hypervisor;

for each of the plurality of guest operating systems executing as guests within the hypervisor a communication channel between the balloon driver in that guest operating system and a virtual machine associated or running on that guest operating system; and

wherein the hypervisor manages the memory space or heap size of the plurality of guest operating systems using the channels.

3. The system of claim 1, wherein the balloon driver controls the heap size of the virtual machine using the balloon driver to virtual machine communication channel.

4. The system of claim 1, wherein the hypervisor divides available physical RAM evenly or in a specified portion between the virtual machine heaps.

5. The system of claim 1, wherein the hypervisor can set different heap sizes for different virtual machines to guarantee conformance to service level contracts which are different for each virtual machine.

6. The system of claim 1, wherein the operating system is specifically tailored to run only a single virtual machine with no swapping and no other user processes.

7. A method for improving memory usage in virtual machines running as hypervisor guests, comprising the steps of

executing a hypervisor on a computer hardware or machine;

providing one or more guest operating systems executing as guests within the hypervisor, wherein each of the one or more guest operating systems has associated therewith a balloon driver, a virtual machine, for executing a software application, a memory space or heap for use by the virtual machine in storing software objects and pointers as part of the software application, and a garbage collector for use by the virtual machine in garbage collecting of software objects within the memory space or heap; and

receiving information about the usage of the memory space or heap by the virtual machine, and using the balloon driver to control the use of the compacting garbage collector and to manage the memory space or heap size as necessary for use by the one or more guest operating systems executing as guests within the hypervisor.

8. The method of claim 7, further comprising:

providing a plurality of guest operating systems executing as guests within the hypervisor;

providing a communication channel between the hypervisor and each of the plurality of guest operating systems executing as guests within the hypervisor;

providing, for each of the plurality of guest operating systems executing as guests within the hypervisor, a communication channel between the balloon driver in that guest operating system and a virtual machine associated or running on that guest operating system; and

allowing the hypervisor to manage the memory space or heap size of the plurality of guest operating systems using the channels.

9. The method of claim 7, wherein the balloon driver controls the heap size of the virtual machine using the balloon driver to virtual machine communication channel.

10. The method of claim 7, wherein the hypervisor divides available physical RAM evenly or in a specified portion between the virtual machine heaps.

11. The method of claim 7, wherein the hypervisor can set different heap sizes for different virtual machines to guarantee conformance to service level contracts which are different for each virtual machine.

12. The method of claim 7, wherein the operating system is specifically tailored to run only a single virtual machine with no swapping and no other user processes.

providing one or more guest operating systems executing as guests within the hypervisor, wherein each of the one or more guest operating systems has associated therewith a balloon driver, a virtual machine, for executing a software application, a memory space or heap for use by the virtual machine in storing software objects and pointers as part of the software application, and a garbage collector for use by the virtual machine in garbage collecting of software objects within the memory space or heap;

determining by the hypervisor that reallocation of physical RAM in the system is necessary;

sending resize commands to the one or more guest operating systems;

examining at each guest operating system balloon driver the status of the corresponding operating system, to determine if a virtual machine with a large heap is running;

if a virtual machine with a large heap is running, then sending a resize command to the virtual machine, and if the virtual machine has to reduce the size of the heap, then allowing the virtual machine to compact the heap, and report back this information; and

reallocating the hypervisor memory as necessary until each of the balloon drivers and virtual machines have performed any necessary memory space or heap reallocation and reported back.

14. The method of claim 13, wherein, if the virtual machine has to increase the size of the heap, then allowing it to increase the heap size.

15. The method of claim 13, wherein if the reduction in size could not be fully performed, then allowing the balloon driver to inflate a balloon.