Interface VmScheduler
- All Known Implementing Classes:
VmSchedulerAbstract,VmSchedulerSpaceShared,VmSchedulerTimeShared
public interface VmScheduler
An interface that represents the policy used by a
Virtual Machine Monitor (VMM) to share the processing power of a
Host between Vms.
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.- Since:
- CloudSim Plus 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleThe default percentage (in scale from [0..1]) to define the CPU overhead of VM migration if one is not explicitly set.static final org.slf4j.Loggerstatic final VmSchedulerAn attribute that implements the Null Object Design Pattern forVmSchedulerobjects. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallocatePesForVm(Vm vm) Requests the allocation of PEs for a VM, according to the number of PEs and MIPS defined by VM attributes.booleanallocatePesForVm(Vm vm, MipsShare requestedMips) Requests the allocation of PEs for a VM.voidReleases all PEs allocated to a VM.voiddeallocatePesFromVm(Vm vm, int pesToRemove) Releases a given number of PEs from a VM.getAllocatedMips(Vm vm) Gets the MIPS share of each Host's Pe that is allocated to a given VM.getHost()doubleGets the max percentage of CPU a VM migrating out of this Host can use.getRequestedMips(Vm vm) Gets the MIPS share requested by a VMdoubleReturns the actual total allocated MIPS for a VM along all its allocated PEs.doubleReturns the total amount of MIPS that is currently free.doubleDefines the percentage of Host's CPU usage increase when a VM is migrating in or out the Host.booleanisSuitableForVm(Vm vm) Checks if the PM using this scheduler has enough MIPS capacity to host a given VM.booleanisSuitableForVm(Vm vm, MipsShare requestedMips) Checks if the MIPS share requested by a VM can be allocated or not.Sets the Host that the VmScheduler get the list of PEs to allocate to VMs.
-
Field Details
-
LOGGER
static final org.slf4j.Logger LOGGER -
DEF_VM_MIGRATION_CPU_OVERHEAD
static final double DEF_VM_MIGRATION_CPU_OVERHEADThe default percentage (in scale from [0..1]) to define the CPU overhead of VM migration if one is not explicitly set.- See Also:
-
NULL
An attribute that implements the Null Object Design Pattern forVmSchedulerobjects.
-
-
Method Details
-
allocatePesForVm
Requests the allocation of PEs for a VM, according to the number of PEs and MIPS defined by VM attributes.- Parameters:
vm- the VM to allocate PEs to- Returns:
- true if the PEs were allocated to the VM, false otherwise
-
deallocatePesFromVm
Releases all PEs allocated to a VM. After that, the PEs may be used on demand by other VMs.- Parameters:
vm- the VM to deallocate PEs from
-
deallocatePesFromVm
Releases a given number of PEs from a VM. After that, the PEs may be used on demand by other VMs.- Parameters:
vm- the VM to deallocate PEs frompesToRemove- number of PEs to deallocate
-
getAllocatedMips
-
getTotalAvailableMips
double getTotalAvailableMips()Returns the total amount of MIPS that is currently free. If there are VMs migrating into the Host, their requested MIPS will already be allocated, reducing the total available MIPS.- Returns:
- the total amount of MIPS that is currently free
-
getRequestedMips
-
isSuitableForVm
Checks if the PM using this scheduler has enough MIPS capacity to host a given VM.- Parameters:
vm- the VM to check if there is enough available resource capacity on the PM to host it- Returns:
- true, if it is possible to allocate the VM into the host; false otherwise
- See Also:
-
getTotalAllocatedMipsForVm
Returns the actual total allocated MIPS for a VM along all its allocated PEs. If the VM is migrating into the Host, then just a fraction of the requested MIPS is actually allocated, representing the overhead of the migration process.The MIPS requested by the VM are just actually allocated after the migration is completed.
- Parameters:
vm- the VM to get the total allocated MIPS- Returns:
- the actual total allocated MIPS for a VM along all its allocated PEs
- See Also:
-
getMaxCpuUsagePercentDuringOutMigration
double getMaxCpuUsagePercentDuringOutMigration()Gets the max percentage of CPU a VM migrating out of this Host can use. Since there may be an overhead associated with the migration process (if the CPU overhead for VM migration is greater than 0), during the migration, the amount of MIPS the VM can use is reduced due to this overhead.- Returns:
- the max percentage of CPU usage during migration (in scale from [0 to 1], where 1 is 100%)
-
getVmMigrationCpuOverhead
double getVmMigrationCpuOverhead()Defines the percentage of Host's CPU usage increase when a VM is migrating in or out the Host.- Returns:
- the Host's CPU migration overhead percentage, in scale from 0 to 1 (where 1 is 100%)
-
getHost
Host getHost()- Returns:
- the Host that the VmScheduler get the list of PEs to allocate to VMs.
-
setHost
Sets the Host that the VmScheduler get the list of PEs to allocate to VMs. A Host for the VmScheduler is defined when the VmScheduler is set to a given Host. Thus, the Host is in charge to set itself to a VmScheduler.- Parameters:
host- the Host to be set- Returns:
- this scheduler
- Throws:
IllegalArgumentException- when the scheduler already is assigned to another Host, since each Host must have its own schedulerNullPointerException- when the host parameter is null