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

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


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Arjun <cse.syslab@xxxxxxxxx>
  • Date: Sat, 15 Apr 2006 02:57:26 -0400
  • Delivery-date: Fri, 14 Apr 2006 23:57:46 -0700
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=lVGp4CVgR0h0iCdAC520K+jsMPBlZjdIHN3LNT16r7Zjj5QptnNVfgMc8cH/U3YfW76JXFjYEOZ0raKdnFd7OHe1+QJQ7hOtm24SSidtDrQhD7KaGy+aHOwoUX5v5ljWZcNEi6/CRfj5sQBajIxh//oyyg8dBlPDdOXTEk+O/Xk=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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

testprog.c
------------------------------------- nested loops -----------------------------
main()
{
        long long int i = 0;
        int j = 0, count = 0;

        do{
          i++;

          for(j=0 ; j < 100 ; j++){
            count = count + 1;
          }


       } while (i < 25999999999LL);
}


------------------------------ nested loops with sleep ----------------------
main()
{
        long long int i = 0;
        int j = 0, count = 0;

        do{
          i++;

          for(j=0 ; j < 1000000 ; j++){
            count = count + 1;
          }
          sleep(1);
          count= 0;

       } while (i < 25999999999LL);
}

-------------------------------------------------------
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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