Linux - Virtualization and CloudThis forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802
Rep:
It doesn't work like that... The VM cores are virtual (obviously?!). What is happening is that the scheduler for kernel on the host is breaking up processing jobs between the machines on the next available processor thread... It is possible to "overbook" the CPUs when setting up VMs and running many at the same time. Luckily, for VM hosts, most computers spend the majority of their CPU time idle. It's part of what makes virtualization of servers so attractive.
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802
Rep:
Don't get caught up thinking that a core is actually sidelined for the virtual machine. Pretty much all the hardware on the virtual machine is "virtual." The VM's "cores" are just time slices on the host's cores... If a server's cores are loaded at 40% capacity, you can get twice that machine's number of virtual CPUs running, without breaking a sweat, as long as your peak use doesn't spike all at once. RAM is a bit different.
Actually my host has 32 cpu and each 8 cores. I really wanna be sure my two VM are sharing exactly the same core(out of 256 available cores). I understand what you mean, but it's possible that OS schedules VM's jobs on different cores(isn't it?). I want to be sure they are always running on the same core.
I can do the following find out pid of all the process which I want to be executed on same core (with other VM's core) and do the following:
taskset -c -p preferred_core pid
and do exactly the same thing on the other VM(with the same core id), is it right?
Now my question:
is it possible that core id(which I'm using) are actually pointing to different physical core? If so, still I can't be sure they are sharing the same core.
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802
Rep:
May I ask why it's so critical that they are executed on a particular core?
Benchmarking? Real time kernels running? Looking to implement a separation kernel for high security reasons? Under ordinary conditions, the scheduler can anticipate loads just fine. Real time systems should ideally use their own hardware. Separation kernels are military grade type stuff...
The only way to get what I assume you are asking for is with a separation kernel on the host/hypervisor.
I did not get the point.
let me elaborate what I want. I don't care if the core is not dedicated to my VM. The only thing that I do care is two VM are running on the same core(even if some other vm or processes are also using that core and I don't care about performance etc.)
So does the aforementioned code help? or there is another problem which I did not get it.
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802
Rep:
Here's the issue... You can't contain the host's use of that same CPU space, including allocation of it to competing VMs. If this is for balance testing, ... That's OK. But be concerned if you are basing billing on these data points... Your clients may have grounds for a false billing practice action against you. If you are trying to obtain data to justify throttling, ... OK. But,are sure that whatever you are doing has a rational relationship to the client VM's use of the CPU and IO, vs others... Or, if this is all internal, that you are use-justifying any policy changes, make sure to cover your bases.
What I am essentially saying is that you cannot base any policy decisions on this so-called empirical data... Nada, ... nill,... It's like the Linux users' (market share) statistics or US unemployment statistics ...
@sanaz: Yes, you can use virsh to do it, or use virt-manager (it's just a GUI for virsh) as the attached screen-shot.
@JaseP: It doesn't matter what the OP's reasons for doing that... he just wants to do it.
He may not want to explain why he needs to do such a thing.
It only needs make sense to him, not the rest of us
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.