This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Re: Strange behavior of simple loop programs in Xen guests.

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Re: Strange behavior of simple loop programs in Xen guests.
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Sat, 15 Apr 2006 17:58:07 -0500
Delivery-date: Sat, 15 Apr 2006 16:00:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM
References: <896ae46a0604142357t447adab7r7701ce00dc359890@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Pan/ (As She Crawled Across the Table (Debian GNU/Linux))
You're experience a well known problem with just about any piece of
virtualization software.

Tools that run in the guest (like sar and top) do not realize that the
guest isn't always running which means they don't take this into account
when calculating percentages.  This makes the output from them pretty much
useless in a virtualized environment.

The IBM zSeries Linux port has some special modifications to take this
trait into account within the kernel so tools like top work like you'd
expect.  I believe someone was looking into doing something like this for


Anthony Liguori

On Sat, 15 Apr 2006 02:57:26 -0400, Arjun wrote:

> Hi,
> I'm running some simple C programs in a Xen 3.0 guest. I have a program
> testprog.c containing simple nested loops (see code below). I run this
> program and check "sar" and "top" output inside the guest and also xentop
> on the host. It shows that the running program takes up almost all the CPU
> time as expected.
> Now I introduce a sleep(1) statement inside my outer loop. On running the
> modified program, both "sar" and "top" in the guest VM show 0% and xentop
> on the host shows about 0.5%
> Next I start about a 100 instances of my loop program (started at skewed
> times) inside the guest VM. A check on sar and top still shows 0% CPU,
> however a check on xentop on the host shows an increase in CPU usage for
> the guest. This changes with the number of instances of the loop program I
> start (more or less linearly).
> I don't understand why this is happening. Why are sar and top showing
> incorrect output in the guest VM. Can anyone explain ?
> P.S: code for the programs is posted below.
> Thanks and regards
> Arjun

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>