pNok
pNok

Reputation: 123

a guestOS process occupies VCPU at any given time?

Recently i`ve been studying something about hardware-supported virtualization.

I read about 3 states of host cpu ,thus the most common userspace,kernelspace and A New Guest State.And as i can see from the ps command,there is a process for the vm i started,and some 'sub'-threads for each cpu owned by the virtual machine.Also i noticed when the vm runs some io related program,some more threads will be created on the host,which i guess might be the responses of qemu for hardware emulation.

So here comes my question:For any certain time(time in guest state,not the other two),does a vcpu thread represent a guestOS process running(i mean 'occupy' and 'exclusively')?just the same as a physical cpu,for any given time in userspace,a user process is running on it. This may sound a little stupid,I just want to figure it out for further research.

To make this question simple: is the vcpu thread which runs on host machine associated with some guestOS process at any given time?

To further simplify it: is it right when i say the guestOS processes are actually running on the host CPU directly and scheduled as ordinary host-processes?the difference between the two kinds of process being what we called virtualization?

Maybe i need another threads to solve some questions about guestOS process switching,but before that,hope you guys can help me with this one.

sincerely MeNok

Upvotes: 0

Views: 139

Answers (2)

Wayne
Wayne

Reputation: 651

VCPU is not a thread in host. KVM allows guest to run directly on a physical CPU with a less privilege guest mode. A timer interrupt will cause CPU back from guest mode to host mode and return to KVM. Since KVM is scheduled in kernel mode, a guest should be also scheduled in the host as well.

Upvotes: 0

Related Questions