Sharing resources

Updated: October 28, 2024

In a hypervisor system, with the exception of small areas of shared memory, memory and devices are exclusively owned by a single entity (guest or hypervisor host).

Multiple guests running in different VMs may use the same system resource, such as a physical CPU. Management of these resources is entirely the domain of the hypervisor. The system integrator's responsibilities are limited to the (very important) question of configuring the appropriate number of vCPUs for each VM, setting their priorities, and binding (pinning) vCPU threads to specific physical CPUs, if required (see Multiprocessing in the Performance Tuning chapter).

Other resources, such as memory and physical devices, are assigned to specific VMs by the VM configurations, which the hypervisor uses to assemble the VMs (see the Configuration chapter). These resources become the exclusive property of the guest running in each VM. They can no more be shared between guests than can physical devices on two separate boards.

Sharing memory

When you configure RAM and ROM for your VM, letting the qvm process choose the host-physical address for the memory is usually the best strategy, because the process will not allocate the same memory location to more than one VM.

A small shared memory region can be an efficient mechanism for passing data between guests in different VMs, however. If you need to configure a shared memory region, you can do so by using a vdev such as vdev-shmem to take advantage of the hypervisor's shared memory services. For more information about how shared memory is implemented, and how to use it, see Memory sharing in the Using Virtual Devices, Networking, and Memory Sharing chapter.

Sharing devices

Like memory, devices can't be shared directly. Virtual devices (whether emulation or para-virtualized) are either implicit (in the qvm process code), or they are shared objects configured into the VM; they are hence exclusive to the VM. Physical devices are either assigned directly to a guest as pass-through devices, or are assigned to the hypervisor host, and accessed by a guest through a virtual device.

If an entity other than the owner of a physical device needs to access that device, it must go through the device owner, just as it would if the device were physically on another board. If the device is owned by the hypervisor host, this is called mediated sharing; if it is owned by another guest, this is called referred sharing. For more information, see Shared devices in this chapter.

  翻译: