[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Why are shared libraries loaded multiple times in a guest VM?

  • To: "Petersson, Mats" <Mats.Petersson@xxxxxxx>
  • From: "Arun Babu" <arunbabu.n@xxxxxxxxx>
  • Date: Tue, 27 Feb 2007 17:03:32 -0500
  • Cc: xen-users@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 27 Feb 2007 14:02:48 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=bE7Tu3R5bPSsDStrXfDtjLQXdbc0TZp+VI2q/GcwOjj0uLk/2ZB27PWEYshUaf/hglDgF/NYYU/xChafaiq8iM1IvJT3C1glac9Ri/YRJ6C1guTv0N3fMefDIwwEv/mHQ70YsgbgnGbzokXG8o9wnMGjXTuSsbFcCHycxJVR9fs=
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

On 2/27/07, Petersson, Mats <Mats.Petersson@xxxxxxx> wrote:

> -----Original Message-----
> From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
> [mailto: xen-users-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Arun Babu
> Sent: 27 February 2007 18:23
> To: xen-users@xxxxxxxxxxxxxxxxxxx
> Subject: [Xen-users] Why are shared libraries loaded multiple
> times in a guest VM?
> Hi,
> I have xen 3.0.2-3 installed with linux guests
> running on them.
> I have a simple test program to print the address of a
> function in a shared library (say printf) using dlopen and
> dlsym. I ran this test on DomO and running another instance
> of the same program (to make sure the library is still
> loaded). Both instances print the same address (as expected).
> But when I do this experiment on a DomU, I get different
> addresses for the same function. Further investigation of
> /proc/<pid>/maps shows that the same shared library is loaded
> in different places on those two machines. Why isn't the
> different instances of the test program refer the same shared
> library/ why is the library loaded multiple times?

Do I get it right that your "complaint" is that the same shared library
is loaded at different places in Dom0 and DomU? Since DomU is a
different (albeit virtual) machine, I don't see what there is to
complain about. In a real system with two different machines, you would
not complain that the shared library is in the memory of both machines,
right? Just because DomU is in the same physical machine as Dom0, it
doesn't have ANY way to actually even know that Dom0 is in the same
machine (aside from some timing aspects of running a virtual machine)
[para-virtual kernels have been modified to do things slightly

Thanks for your suggestions. But I think you got the issue wrongly.
What I am concerned is that how a library, which is already loaded in the
memory  is reloaded at a different place once again when another instance of the program
is started. (Please note that the 1st instance is still running on a busy loop while the second
instance is started.) Should'nt the second instance use the shared library which is available
in the memory?  This is all happening within a guest VM. I am not comparing
anything with Dom0.
(I do understand that we treat virtual machines as different physical ones and they are
not sharing pages!)

Obviously, if that's not what you're complaining about, sorry for
misunderstanding the "complaint"...

The fact that the same shared library is loaded at a different address
within the virtual address range is probably something to do with what
virtual addresses are available and it may also depend on what other
shared libraries have already been loaded prior to this shared library -
shared libraries are located at "random" addresses in memory to avoid
collisions, but sometimes you get collisions anyways, and the OS will
then pick a different (free) random address. You'd probably find the
same thing if you have two different machines with slightly different
configurations and perhaps different daemons running (xend for example
will drag in a whole heap of shared libraries, both those belonging to
the python language and those built by xen).

> Can somebody help me reason out why this is happening in
> guest vm? Is this because of some boot option or anything
> specific to xen?
> Thank you
> Arun
> --
> http://www4.ncsu.edu/~abnagara <http://www4.ncsu.edu/~abnagara >

"You just have to keep breathing. Because the sun will rise. And you never know what the tide will bring in" -- Chuck Noland :)
visit: http://www4.ncsu.edu/~abnagara
Xen-users mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.