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: Xen cpu Scheduling

To: pak333@xxxxxxxxxxx
Subject: [Xen-devel] Re: Xen cpu Scheduling
From: "Mike D. Day" <ncmike@xxxxxxxxxx>
Date: Tue, 20 Mar 2007 15:16:17 -0400
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 20 Mar 2007 12:15:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <032020070137.15717.45FF3ABE0000295A00003D652200762194CCCCCC050E9F@xxxxxxxxxxx>
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 Linux Technology Center
References: <032020070137.15717.45FF3ABE0000295A00003D652200762194CCCCCC050E9F@xxxxxxxxxxx>
Reply-to: ncmike@xxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.11
On 20/03/07 01:37 +0000, pak333@xxxxxxxxxxx wrote:

  1. Suppose I give a VM 2 vcpus. When this VM gets scheduled will it
  always be given two pcpus or can it be given 1vcpu also sometimes.
  For example if we have mutiple VMs running, and if a cpu gets freed up
  will my 2vcpu VM be scheduled on this single free cpu.  If a single
  cpu cna be given how is the cpu % calculated by xentop

It depends on how busy the CPUs are on the machine, and the ratio of

When the VM has two VCPUs, each VCPU (when runnable) will be put on
the run queue of a physical CPU. This VM will run concurrently on AT
MOST 2 PCPUs, sometimes only 1 PCPU. If on the platform VCPU == PCPU
in aggregate then the VM with 2 VCPUs will frequently run concurrently
on two PCPUs.

  2. If the 2vcpu is scheduled on two cpus, and one of its threads goes
  to sleep can that single thread be context swtiched out. or will it be
  kept spinning.

VM's get scheduled as VCPUs, not threads. Having two VCPU's for a VM
is sort of like a process having two threads. But there are a lot of
differences as well so don't take the analogy too far.

When a VCPU for a  VM is not running it is not executing any code. The
VCPU can be runnable, running, or sleeping. It only executes code when
it is running.
However, remember that *kernel threads* are scheduled by the guest kernel,
while the guest kernel is scheduled as one or more VCPUs by *xen.* The
guest kernel is allowed to put its own threads to sleep and awaken
other threads, but when Xen decides that the time slice is over for a
VCPU, then that VCPU  gets rescheduled at the back of the q, or put to
sleep. I don't know very much about xentop.

Mike D. Day
Cell: 919 412-3900
Sametime: ncmike@xxxxxxxxxx AIM: ncmikeday  Yahoo: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc

Xen-devel mailing list

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