Class VmAllocationPolicyRandom
java.lang.Object
org.cloudsimplus.allocationpolicies.VmAllocationPolicyAbstract
org.cloudsimplus.allocationpolicies.VmAllocationPolicyRandom
- All Implemented Interfaces:
VmAllocationPolicy
public class VmAllocationPolicyRandom
extends VmAllocationPolicyAbstract
implements VmAllocationPolicy
A VM allocation policy
which finds a random Host having suitable resources to place a given VM.
This is a high time-efficient policy with a best-case complexity O(1)
and a worst-case complexity O(N), where N is the number of Hosts.
NOTES:
- This policy doesn't perform optimization of VM allocation by means of VM migration.
- It has a low computational complexity (high time-efficient) but may return an inactive Host that will be activated, while there may be active Hosts suitable for the VM.
- Despite the low computational complexity, such a policy may increase the number of active Hosts, that increases power consumption.
- Since:
- CloudSim Plus 4.4.2
- Author:
- Manoel Campos da Silva Filho
-
Field Summary
Fields inherited from interface org.cloudsimplus.allocationpolicies.VmAllocationPolicy
DEF_HOST_COUNT_PARALLEL_SEARCH, LOGGER, NULL -
Constructor Summary
ConstructorsConstructorDescriptionVmAllocationPolicyRandom(@NonNull ContinuousDistribution random) Creates a VmAllocationPolicy. -
Method Summary
Modifier and TypeMethodDescriptionProvides the default implementation of the policy to find a suitable Host for a given VM.Methods inherited from class org.cloudsimplus.allocationpolicies.VmAllocationPolicyAbstract
allocateHostForVm, allocateHostForVm, allocateHostForVm, allocateHostForVmInternal, deallocateHostForVm, findHostForVm, getHostList, getOptimizedAllocationMap, isVmMigrationSupported, scaleVmVertically, setFindHostForVmFunctionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cloudsimplus.allocationpolicies.VmAllocationPolicy
allocateHostForVm, allocateHostForVm, allocateHostForVm, deallocateHostForVm, findHostForVm, getDatacenter, getHostCountForParallelSearch, getHostList, getOptimizedAllocationMap, isParallelHostSearchEnabled, isVmMigrationSupported, scaleVmVertically, setDatacenter, setFindHostForVmFunction, setHostCountForParallelSearch
-
Constructor Details
-
VmAllocationPolicyRandom
Creates a VmAllocationPolicy.- Parameters:
random- a Pseudo-Random Number Generator (PRNG) used to select a Host. The PRNG must return values between 0 and 1.
-
-
Method Details
-
defaultFindHostForVm
Description copied from class:VmAllocationPolicyAbstractProvides the default implementation of the policy to find a suitable Host for a given VM.- Specified by:
defaultFindHostForVmin classVmAllocationPolicyAbstract- Parameters:
vm- the VM to find a suitable Host to- Returns:
- an
Optionalcontaining a suitable Host to place the VM; or an emptyOptionalif no suitable Host was found - See Also:
-