Class VmSchedulerTimeShared

java.lang.Object
org.cloudbus.cloudsim.schedulers.vm.VmSchedulerAbstract
org.cloudbus.cloudsim.schedulers.vm.VmSchedulerTimeShared
All Implemented Interfaces:
VmScheduler
Direct Known Subclasses:
VmSchedulerTimeSharedOverSubscription

public class VmSchedulerTimeShared
extends VmSchedulerAbstract
VmSchedulerTimeShared is a Virtual Machine Monitor (VMM), also called Hypervisor, that defines a policy to allocate one or more PEs from a PM 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 over-subscription.

Each host has to use is 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 in order to move running VMs to the waiting list in order to make room for other already waiting VMs to run. It just imposes there is not waiting VMs, oversimplifying the scheduling, considering that for a given simulation second t, the total processing capacity of the processor cores (in MIPS) is equally divided by the VMs that are using them.

In processors 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, two virtual PEs can be allocated to the same physical PE, but a single virtual PE must be allocated to just one physical PE.

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.
    • 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 List 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 list of MIPS to allocate to the VM, after it being adjusted by the VmSchedulerAbstract.getMipsShareRequestedReduced(Vm, MipsShare) method.
      See Also:
      VmSchedulerAbstract.getMipsShareRequestedReduced(Vm, MipsShare)
    • 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 list of MIPS 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 void deallocatePesFromVmInternal​(Vm vm, int pesToRemove)
      Specified by:
      deallocatePesFromVmInternal in class VmSchedulerAbstract
    • deallocatePesForAllVms

      public void deallocatePesForAllVms()
      Releases PEs allocated to all the VMs.
      Specified by:
      deallocatePesForAllVms in interface VmScheduler
      Overrides:
      deallocatePesForAllVms in class VmSchedulerAbstract