Class VmSchedulerTimeShared

java.lang.Object
org.cloudsimplus.schedulers.vm.VmSchedulerAbstract
org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared
All Implemented Interfaces:
VmScheduler

public class VmSchedulerTimeShared extends VmSchedulerAbstract

A Virtual Machine Monitor (VMM), also called Hypervisor, that defines a policy to allocate one or more Pes from a Host to a Vm, and allows sharing of PEs by multiple VMs. This class also implements 10% performance degradation due to VM migration. It does not support resource over-subscription.

Each Host has to use its own instance of a VmScheduler that will so schedule the allocation of Host's PEs for VMs running on it.

It does not perform a preemption process to move running VMs to the waiting list to make room for other VMs already waiting. It just imposes there isn't waiting VMs, oversimplifying the scheduling, considering that for a given simulation second t, the total processing capacity (in MIPS) of the processor cores (Pes) is equally divided by the VMs that are using them.

In CPUs enabled with Hyper-threading technology (HT), it is possible to run up to 2 processes at the same physical CPU core. However, this scheduler implementation oversimplifies a possible HT feature by allowing several VMs to use a fraction of the MIPS capacity from physical PEs, until that the total capacity of the virtual PE is allocated. Consider that a virtual PE is requiring 1000 MIPS but there is no physical PE with such a capacity. The scheduler will allocate these 1000 MIPS across several physical PEs, for instance, by allocating 500 MIPS from PE 0, 300 from PE 1 and 200 from PE 2, totaling the 1000 MIPS required by the virtual PE.

In a real hypervisor in a Host that has Hyper-threading CPU cores, one physical PE can be allocated to two virtual PEs (preemptively), but a single virtual PE can use just one physical PE at a time.

Since:
CloudSim Toolkit 1.0
Author:
Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
  • Constructor Details

    • VmSchedulerTimeShared

      public VmSchedulerTimeShared()
      Creates a time-shared VM scheduler with a default CPU overhead for VM migrations.
    • VmSchedulerTimeShared

      public VmSchedulerTimeShared(double vmMigrationCpuOverhead)
      Creates a time-shared VM scheduler, defining a CPU overhead for VM migration.
      Parameters:
      vmMigrationCpuOverhead - the percentage of Host's CPU usage increase when a VM is migrating in or out of the Host. The value is in scale from 0 to 1 (where 1 is 100%).
  • Method Details

    • allocatePesForVmInternal

      public boolean allocatePesForVmInternal(Vm vm, MipsShare requestedMips)
      Specified by:
      allocatePesForVmInternal in class VmSchedulerAbstract
    • allocateMipsShareForVm

      protected void allocateMipsShareForVm(Vm vm, MipsShare requestedMipsReduced)
      Performs the allocation of a MIPS share to a given VM. The actual MIPS to be allocated to the VM may be reduced if the VM is in migration, due to migration overhead.
      Parameters:
      vm - the VM to allocate MIPS to
      requestedMipsReduced - the MIPS share to allocate to the VM, after it being adjusted by the VmSchedulerAbstract.getMipsShareRequestedReduced(Vm, MipsShare) method.
      See Also:
    • isSuitableForVmInternal

      protected boolean isSuitableForVmInternal(Vm vm, MipsShare requestedMips)
      The non-emptiness of the list is ensured by the VmScheduler.isSuitableForVm(Vm, MipsShare) method.
      Specified by:
      isSuitableForVmInternal in class VmSchedulerAbstract
    • getMipsShareToAllocate

      protected MipsShare getMipsShareToAllocate(Vm vm, MipsShare requestedMips)
      Gets the actual MIPS share that will be allocated to VM's PEs, considering the VM migration status. If the VM is in migration, this will cause overhead, reducing the amount of MIPS allocated to the VM.
      Parameters:
      vm - the VM requesting allocation of MIPS
      requestedMips - the MIPS share requested for each vPE
      Returns:
      the allocated MIPS share to the VM
    • getMipsShareToAllocate

      protected MipsShare getMipsShareToAllocate(MipsShare requestedMips, double scalingFactor)
      Gets the actual MIPS share that will be allocated to VM's PEs, considering the VM migration status. If the VM is in migration, this will cause overhead, reducing the amount of MIPS allocated to the VM.
      Parameters:
      requestedMips - the list of MIPS requested for each vPE
      scalingFactor - the factor that will be used to reduce the amount of MIPS allocated to each vPE (which is a percentage value between [0..1]) in case the VM is in migration
      Returns:
      the MIPS share allocated to the VM
    • deallocatePesFromVmInternal

      protected long deallocatePesFromVmInternal(Vm vm, int pesToRemove)
      Specified by:
      deallocatePesFromVmInternal in class VmSchedulerAbstract