That's the idea behind a technique that
I'm going to describe to you called ballooning.
The idea is to have a special device driver installed in every guest operating
system. So even if it is a fully virtualized setting, since device drivers can
be installed on the fly, with the
cooperation of the guest operating system. The hypervisor
can install the device driver, which is
called a balloon, in the operating system.
And this balloon device driver is the
key for managing memory pressures that maybe experienced
by a virtual machine or a desktop operating system. In a virtualized setting.
Let's say that the house needs more memory suddenly. And this may be a result of
another guest operating system, saying that it
needs more memory. So what the hypervisor would
do, is It'll contact one of the
guest operating system that currently is not actively
using all of its memory, let's say. And talk to this balloon driver that it
has installed through a private channel that
exists between the hypervisor and the balloon driver.
So this is something that only the hypervisor knows
about because this is a special device driver that
the hypervisor has installed. It knows how to get
to this device driver and tell it to do something.
And in this case, what the hypervisor is going to
do is tell this balloon device driver to inflate. What
that means is that this balloon device driver is
going to make requests to the guest operating system saying I
need more memory. I need more memory, I
need more memory. And the guest operating system will
of course, give this balloon driver the memory that
it is requesting. And since the amount of physical
memory that's available to the guest operating system
is finite. If one process, in this case, the
balloon driver, is making requests from the guest saying
give me more memory. Guest has to necessarily make
room for that by paging out to the
disk unwanted pages from the total memory footprint
of all the processes that are currently running
in this guest operating system. And once it is
done the swapping out of pages, and perhaps
even entire processes out onto the disc. That's
the way it can make room for the
request that is coming from this balloon driver. Now,
once the balloon driver has gotten all this extra memory out of this
guest operating system. It can return those physical memories.
The real physical memory, or the machine memory, back to the hypervisor. So we
started with this house needing more machine memory. And the way,
the house got that more machine memory is by contacting
its balloon driver installed in one of the guest operating systems that is not
actively using all of its resources. Asking the balloon to inflate and inflating
the balloon is essentially meaning that we
are acquiring more memory from the guest
operating system. So, you can see visually
that the footprint of the balloon goes
up because of the inflation. That means, it's got
a bigger memory footprint. And all of this memory
footprint has extra resources that it can simply return
to the hypervisor. It's not going to use it. It
just wants to get it so that it can
return it to the hypervisor. So that's this path
here. So the opposite of what I've just described
is a situation where the house needs less memory.
Or, in other words, it has more memory
to give away to guest operating system. So maybe
it is this guest that requested more memory
in the first place, And in that case, it
wants the guest to get to the memory that it wanted. And the way it
can do that is as follows. Once again the
hypovisor through it's private channel will contact the balloon driver and
tell the balloon driver to deflate the
balloon. By deflate what is being instructed
to the balloon driver is to contract
its memory footprint. So, if it contracts its
memory footprint by deflating, it is actually
releasing memory into the guest operations. So,
available physical memory. In the guest operating
system is going to increase, because of the fact
that the balloon is deflating and giving out
the memory that is currently sitting on. So
now the guest operating system has more memory
to play with. That's the effect of the balloon
deflating is that the guest operating system has
more memory. Which means that it can page
in from the disk, the working set of
processes that are executing on this guest operating system.
So that those processes can have more memory resources than they've been able to
because of the balloon occupying a lot of the memory. So, this technique
of ballooning assumes cooperation with the guest
operating system. So that based on the
need of the hour the hypervisor can
work with the guest operating system implicitly.
Without the guest really knowing about it
because it is all happening through the
balloon driver that has been installed. By the hypervisor in each of the guest
operating systems. And this technique of ballooning
is applicable to both fully virtualized and
para-virtualized environments to ease the over commitment
of memory by the hypervisor to the guests.
I mean, it's sort of line airline reservations. You
always Notice that in airline reservation, the airlines tend
to sell more seats than what they have with
the hope that someone is not going to show up.
That's the same sort of thing that is being
done here that there is a finite amount of
physical resources available with the hypervisor. And it is
doling it out to all the guest operating systems.
>> And what it wants to do is,
it wants to be able to reacquire some of those resources to satisfy the needs
of another guest operating system that is experiencing
a memory pressure at any point of time.