Class VmAllocationPolicySimple
java.lang.Object
org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicyAbstract
org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicySimple
- All Implemented Interfaces:
VmAllocationPolicy
A VmAllocationPolicy implementation that chooses, as
the host for a VM, that one with the fewest PEs in use.
It is therefore a Worst Fit policy, allocating each VM into the host with most available PEs.
This is a really computationally complex policy since the worst-case complexity to allocate a Host for a VM is O(N), where N is the number of Hosts. Such an implementation is not appropriate for large scale scenarios.
NOTE: This policy doesn't perform optimization of VM allocation by means of VM migration.
- Since:
- CloudSim Toolkit 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
- See Also:
-
Field Summary
Fields inherited from interface org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicy
DEF_HOST_COUNT_PARALLEL_SEARCH, LOGGER, NULL
-
Constructor Summary
ConstructorDescriptionInstantiates a VmAllocationPolicySimple.VmAllocationPolicySimple
(BiFunction<VmAllocationPolicy, Vm, Optional<Host>> findHostForVmFunction) Instantiates a VmAllocationPolicySimple, changing theFunction
to select a Host for a Vm in order to define a different policy. -
Method Summary
Modifier and TypeMethodDescriptionGets the first suitable host from theVmAllocationPolicyAbstract.getHostList()
that has the fewest number of used PEs (i.e, higher free PEs).Methods inherited from class org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicyAbstract
allocateHostForVm, allocateHostForVm, allocateHostForVm, deallocateHostForVm, findHostForVm, getDatacenter, getHostCountForParallelSearch, getHostList, getOptimizedAllocationMap, isVmMigrationSupported, scaleVmVertically, setDatacenter, setFindHostForVmFunction, setHostCountForParallelSearch
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicy
isParallelHostSearchEnabled
-
Constructor Details
-
VmAllocationPolicySimple
public VmAllocationPolicySimple()Instantiates a VmAllocationPolicySimple. -
VmAllocationPolicySimple
public VmAllocationPolicySimple(BiFunction<VmAllocationPolicy, Vm, Optional<Host>> findHostForVmFunction) Instantiates a VmAllocationPolicySimple, changing theFunction
to select a Host for a Vm in order to define a different policy.- Parameters:
findHostForVmFunction
- aFunction
to select a Host for a given Vm.- See Also:
-
-
Method Details
-
defaultFindHostForVm
Gets the first suitable host from theVmAllocationPolicyAbstract.getHostList()
that has the fewest number of used PEs (i.e, higher free PEs).- Specified by:
defaultFindHostForVm
in classVmAllocationPolicyAbstract
- Parameters:
vm
- the VM to find a suitable Host to- Returns:
- an
Optional
containing a suitable Host to place the VM or an emptyOptional
if not found - See Also:
-