|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] Question about memory management in Xen
> I have a question about the memory management in Xen. Suppose I start
> 2 DomU instances and both of them use the same kernel image. In this case,
>
> 1) will Xen make two copy of the kernel image in the memory, i.e., occupy
> 2*sizeof(kernel image) space in the physical memory or,
This is the case under Xen. Each domain gets built in entirely separate
memory and the kernel is copied into there.
> 2) will Xen only have one copy of the read-only pages of the kernel
> image (for instance, text section, rodata section) in the physical
> memory? Because I read
> somewhere about that, Unix will only have one copy of read-only pages in
> the memory and share them among processes. How about Xen? Any thoughts?
Xen doesn't share memory in this case. This costs some space but kernel
images are typically not that large compared to the total memory used by a
VM. The Xen model basically gives each guest a separate, independent memory
like a real machine would. Most VMMs at least try to present this appearance
to the guest.
I know that VMware ESX is able to unify identical pages between virtual
machines once they're are running in order to save memory. This applies to
both kernel and userspace pages, both code and data. I don't definitely know
of any other x86-based VMM which does sharing like this.
IBM's zSeries boxes can share memory for things like kernel text, but they use
a special kind of memory segment for this. The memory management
architecture of the zSeries is pretty strange, coming from an x86 background.
In principle, Xen could unify identical pages in a similar way to VMware ESX
by using shadow pagetables. Another option would be getting guests to
co-operate explicitly (I've been hacking on something similar to this) with
the sharing. The "Potemkin virtual honey farm" uses shadow pagetables to
allow guests that have been "forked" from a common parent to share memory in
a copy-on-write fashion.
Hope that helps.
Cheers,
Mark
--
Dave: Just a question. What use is a unicyle with no seat? And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|