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

[Xen-devel] Re: Xen cpu Scheduling



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
VCPU to PCPU.

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

--
Mike D. Day
IBM LTC
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
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®.