Interface CloudletScheduler
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
CloudletSchedulerAbstract
,CloudletSchedulerCompletelyFair
,CloudletSchedulerSpaceShared
,CloudletSchedulerTimeShared
An interface to be implemented by each class that provides a policy
of scheduling performed by a virtual machine to run its
Cloudlets
.
Each VM has to have its own instance of a CloudletScheduler.
It also implements the Null Object
Design Pattern in order to start avoiding NullPointerException
when
using the NULL
object instead of attributing null
to
CloudletScheduler
variables.
- Since:
- CloudSim Plus 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.slf4j.Logger
static final CloudletScheduler
An attribute that implements the Null Object Design Pattern forCloudletScheduler
objects. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCloudletToReturnedList
(Cloudlet cloudlet) Adds a Cloudlet to the list of finished Cloudlets that have been returned to itsDatacenterBroker
.addOnCloudletResourceAllocationFail
(EventListener<CloudletResourceAllocationFailEventInfo> listener) Adds a listener object that will be notified every time aCloudletScheduler
is not able to allocated the amount of resource aCloudlet
is requesting due to lack of available capacity.void
clear()
Clears the internal state of the schedulercloudletCancel
(Cloudlet cloudlet) Cancels execution of a cloudlet.cloudletFail
(Cloudlet cloudlet) Sets a cloudlet as failed.boolean
cloudletPause
(Cloudlet cloudlet) Pauses execution of a cloudlet.boolean
cloudletReady
(Cloudlet cloudlet) Sets the status of a Cloudlet toCloudlet.Status.READY
so that it can start executing as soon as possible.double
cloudletResume
(Cloudlet cloudlet) Resumes execution of a paused cloudlet.double
cloudletSubmit
(Cloudlet cloudlet) Receives an cloudlet to be executed in the VM managed by this scheduler.double
cloudletSubmit
(Cloudlet cloudlet, double fileTransferTime) Receives a cloudlet to be executed in the VM managed by this scheduler.void
deallocatePesFromVm
(long pesToRemove) Releases a given number of PEs from a VM.Enables the history of all Cloudlets submitted so far.double
getAllocatedCpuPercent
(double time) Gets total CPU utilization percentage allocated (from MIPS capacity) to all cloudlets, according to CPU UtilizationModel of each one (in scale from 0 to 1, where 1 is 100%).Gets a read-only List of cloudlets being executed on the VM.Gets a list of finished cloudlets.Gets a read-only List of all cloudlets which are either waiting or executing on the VM.Gets the list of all Cloudlets submitted for a VM so far.Gets a read-only List of cloudlet waiting to be executed on the VM.double
/** Gets the current utilization percentage of Bandwidth that the running Cloudlets are requesting (in scale from 0 to 1).double
Gets the current utilization percentage of RAM that the running Cloudlets are requesting (in scale from 0 to 1).long
Gets the number of PEs currently not being used.double
Gets the previous time when the scheduler updated the processing of cloudlets it is managing.double
getRequestedCpuPercent
(double time) Gets total CPU percentage requested (from MIPS capacity) from all cloudlets, according to CPU UtilizationModel of each one (in scale from 0 to 1, where 1 is 100%).Gets theCloudletTaskScheduler
that will be used by this CloudletScheduler to processVmPacket
s to be sent or received by the Vm that is assigned to the current CloudletScheduler.long
Gets the number of currently usedPe
's.getVm()
Gets the Vm that uses the scheduler.boolean
Informs if there is any cloudlet that finished to execute in the VM managed by this scheduler.boolean
isEmpty()
Checks if there aren't cloudlets waiting or executing inside the Vm.boolean
Checks if there is aCloudletTaskScheduler
assigned to this CloudletScheduler in order to enable tasks execution and dispatching packets from and to the Vm of this CloudletScheduler.boolean
removeOnCloudletResourceAllocationFail
(EventListener<CloudletResourceAllocationFailEventInfo> listener) Removes a Listener object from the registered List.void
setTaskScheduler
(CloudletTaskScheduler taskScheduler) Sets theCloudletTaskScheduler
that will be used by this CloudletScheduler to processVmPacket
s to be sent or received by the Vm that is assigned to the current CloudletScheduler.void
Sets the Vm that will use the scheduler.double
updateProcessing
(double currentTime, MipsShare mipsShare) Updates the processing of cloudlets inside the Vm running under management of this scheduler.
-
Field Details
-
LOGGER
static final org.slf4j.Logger LOGGER -
NULL
An attribute that implements the Null Object Design Pattern forCloudletScheduler
objects.
-
-
Method Details
-
cloudletFail
Sets a cloudlet as failed.- Parameters:
cloudlet
- ID of the cloudlet to set as failed- Returns:
- the failed cloudlet or
Cloudlet.NULL
if not found
-
cloudletCancel
Cancels execution of a cloudlet.- Parameters:
cloudlet
- the cloudlet being canceled- Returns:
- the canceled cloudlet or
Cloudlet.NULL
if not found
-
cloudletReady
Sets the status of a Cloudlet toCloudlet.Status.READY
so that it can start executing as soon as possible.- Parameters:
cloudlet
- the cloudlet to be started- Returns:
- $true if cloudlet was set to ready, $false otherwise
-
cloudletPause
Pauses execution of a cloudlet.- Parameters:
cloudlet
- the cloudlet being paused- Returns:
- $true if cloudlet was paused, $false otherwise
-
cloudletResume
Resumes execution of a paused cloudlet.- Parameters:
cloudlet
- the cloudlet being resumed- Returns:
- expected finish time of the cloudlet, 0.0 if queued or not found in the paused list
-
cloudletSubmit
Receives a cloudlet to be executed in the VM managed by this scheduler.- Parameters:
cloudlet
- the submitted cloudletfileTransferTime
- time required to move the required files from the SAN to the VM- Returns:
- expected finish time of this cloudlet (considering the time to transfer required files from the Datacenter to the Vm), or 0 if it is in a waiting queue
-
cloudletSubmit
Receives an cloudlet to be executed in the VM managed by this scheduler.- Parameters:
cloudlet
- the submitted cloudlet- Returns:
- expected finish time of this cloudlet (considering the time to transfer required files from the Datacenter to the Vm), or 0 if it is in a waiting queue
-
getCloudletExecList
List<CloudletExecution> getCloudletExecList()Gets a read-only List of cloudlets being executed on the VM.- Returns:
- the cloudlet execution list
-
getCloudletSubmittedList
Gets the list of all Cloudlets submitted for a VM so far. This can be used at the end of the simulation to know which Cloudlets have been sent to a VM.WARNING: Keep in mind that the history in this List is just kept if
enableCloudletSubmittedList()
is called.- Type Parameters:
T
- the class of Cloudlets inside the list- Returns:
- the list of all submitted Cloudlets
-
enableCloudletSubmittedList
CloudletScheduler enableCloudletSubmittedList()Enables the history of all Cloudlets submitted so far.- See Also:
-
getCloudletWaitingList
List<CloudletExecution> getCloudletWaitingList()Gets a read-only List of cloudlet waiting to be executed on the VM.- Returns:
- the cloudlet waiting list
-
getCloudletList
Gets a read-only List of all cloudlets which are either waiting or executing on the VM.- Returns:
- the list of waiting and executing cloudlets
-
getCloudletFinishedList
List<CloudletExecution> getCloudletFinishedList()Gets a list of finished cloudlets.- Returns:
- the cloudlet finished list
-
isEmpty
boolean isEmpty()Checks if there aren't cloudlets waiting or executing inside the Vm.- Returns:
- true if there aren't waiting or executing Cloudlets, false otherwise.
-
deallocatePesFromVm
void deallocatePesFromVm(long pesToRemove) Releases a given number of PEs from a VM.- Parameters:
pesToRemove
- number of PEs to deallocate
-
getCurrentRequestedBwPercentUtilization
double getCurrentRequestedBwPercentUtilization()/** Gets the current utilization percentage of Bandwidth that the running Cloudlets are requesting (in scale from 0 to 1).- Returns:
- the BW utilization percentage from 0 to 1 (where 1 is 100%)
-
getCurrentRequestedRamPercentUtilization
double getCurrentRequestedRamPercentUtilization()Gets the current utilization percentage of RAM that the running Cloudlets are requesting (in scale from 0 to 1).- Returns:
- the RAM utilization percentage from 0 to 1 (where 1 is 100%)
-
getPreviousTime
double getPreviousTime()Gets the previous time when the scheduler updated the processing of cloudlets it is managing.- Returns:
- the previous time
-
getRequestedCpuPercent
double getRequestedCpuPercent(double time) Gets total CPU percentage requested (from MIPS capacity) from all cloudlets, according to CPU UtilizationModel of each one (in scale from 0 to 1, where 1 is 100%).- Parameters:
time
- the time to get the current CPU utilization- Returns:
- the total CPU percentage requested
-
getAllocatedCpuPercent
double getAllocatedCpuPercent(double time) Gets total CPU utilization percentage allocated (from MIPS capacity) to all cloudlets, according to CPU UtilizationModel of each one (in scale from 0 to 1, where 1 is 100%).- Parameters:
time
- the time to get the current CPU utilization- Returns:
- the total CPU utilization percentage allocated
-
hasFinishedCloudlets
boolean hasFinishedCloudlets()Informs if there is any cloudlet that finished to execute in the VM managed by this scheduler.- Returns:
- $true if there is at least one finished cloudlet; $false otherwise
-
getTaskScheduler
CloudletTaskScheduler getTaskScheduler()Gets theCloudletTaskScheduler
that will be used by this CloudletScheduler to processVmPacket
s to be sent or received by the Vm that is assigned to the current CloudletScheduler.- Returns:
- the CloudletTaskScheduler for this CloudletScheduler or
CloudletTaskScheduler.NULL
if this scheduler will not deal with packets transmission.
-
setTaskScheduler
Sets theCloudletTaskScheduler
that will be used by this CloudletScheduler to processVmPacket
s to be sent or received by the Vm that is assigned to the current CloudletScheduler. The Vm from the CloudletScheduler is also set to the CloudletTaskScheduler.This attribute usually doesn't need to be set manually. See the note at the
CloudletTaskScheduler
interface for more details.- Parameters:
taskScheduler
- the CloudletTaskScheduler to set for this CloudletScheduler orCloudletTaskScheduler.NULL
if this scheduler will not deal with packets transmission.
-
isThereTaskScheduler
boolean isThereTaskScheduler()Checks if there is aCloudletTaskScheduler
assigned to this CloudletScheduler in order to enable tasks execution and dispatching packets from and to the Vm of this CloudletScheduler.- Returns:
-
getVm
Vm getVm()Gets the Vm that uses the scheduler.- Returns:
-
setVm
Sets the Vm that will use the scheduler. It is not required to manually set a Vm for the scheduler, since aVm
sets itself to the scheduler when the scheduler is assigned to the Vm.- Parameters:
vm
- the Vm to set- Throws:
IllegalArgumentException
- when the scheduler already is assigned to another Vm, since each Vm must have its own schedulerNullPointerException
- when the vm parameter is null
-
getUsedPes
long getUsedPes()Gets the number of currently usedPe
's.- Returns:
-
getFreePes
long getFreePes()Gets the number of PEs currently not being used.- Returns:
-
addCloudletToReturnedList
Adds a Cloudlet to the list of finished Cloudlets that have been returned to itsDatacenterBroker
.- Parameters:
cloudlet
- the Cloudlet to be added
-
clear
void clear()Clears the internal state of the scheduler -
addOnCloudletResourceAllocationFail
CloudletScheduler addOnCloudletResourceAllocationFail(EventListener<CloudletResourceAllocationFailEventInfo> listener) Adds a listener object that will be notified every time aCloudletScheduler
is not able to allocated the amount of resource aCloudlet
is requesting due to lack of available capacity.- Parameters:
listener
- the Listener to add- Returns:
-
removeOnCloudletResourceAllocationFail
boolean removeOnCloudletResourceAllocationFail(EventListener<CloudletResourceAllocationFailEventInfo> listener) Removes a Listener object from the registered List.- Parameters:
listener
- the Listener to remove- Returns:
- true if the Listener was removed, false otherwise
-