Interface CloudletScheduler
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
CloudletSchedulerAbstract,CloudletSchedulerCompletelyFair,CloudletSchedulerSpaceShared,CloudletSchedulerTimeShared
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.slf4j.Loggerstatic final CloudletSchedulerAn attribute that implements the Null Object Design Pattern forCloudletSchedulerobjects. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloudletToReturnedList(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 aCloudletScheduleris not able to allocate the amount of resource aCloudletis requesting, due to lack of available capacity.voidclear()Clears the internal state of the schedulercloudletCancel(Cloudlet cloudlet) Cancels the execution of a cloudlet.cloudletFail(Cloudlet cloudlet) Sets a cloudlet as failed.booleancloudletPause(Cloudlet cloudlet) Pauses the execution of a cloudlet.booleancloudletReady(Cloudlet cloudlet) Sets the status of a Cloudlet toCloudlet.Status.READYso that it can start executing as soon as possible.doublecloudletResume(Cloudlet cloudlet) Resumes execution of a paused cloudlet.doublecloudletSubmit(Cloudlet cloudlet) Receives a cloudlet to be executed in the VM managed by this scheduler.doublecloudletSubmit(Cloudlet cloudlet, double fileTransferTime) Receives a cloudlet to be executed in the VM managed by this scheduler.voiddeallocatePesFromVm(long pesToRemove) Releases a given number of PEs from a VM.Enables the history of all Cloudlets submitted so far.doublegetAllocatedCpuPercent(double time) Gets total CPU utilization percentage allocated (from MIPS capacity) to all cloudlets, according to CPUUtilizationModelof each Cloudlet.Gets the list of all Cloudlets submitted for a VM so far.doubleGets the current utilization percentage of Bandwidth that the running Cloudlets are requesting (in scale from 0 to 1).doubleGets the current utilization percentage of RAM that the running Cloudlets are requesting (in scale from 0 to 1).longdoubledoublegetRequestedCpuPercent(double time) Gets total CPU percentage requested (from MIPS capacity) from all cloudlets, according to CPUUtilizationModelof each Cloudlet.Gets theCloudletTaskSchedulerto process cloudlet tasks namely (i) sending or receivingVmPackets by the Vm assigned to the current CloudletScheduler, or (ii) scheduling execution tasks.longgetVm()booleanInforms if there is any cloudlet that finished executing in the VM managed by this scheduler.booleanReturns true or false if the list of all Cloudlets submitted so far is enabled.booleanisEmpty()Checks if there aren't cloudlets waiting or executing inside the Vm.booleanChecks if there is aCloudletTaskSchedulerassigned to this CloudletScheduler to enable tasks execution and dispatching packets from and to the Vm of this CloudletScheduler.booleanremoveOnCloudletResourceAllocationFail(EventListener<CloudletResourceAllocationFailEventInfo> listener) Removes a Listener object from the registered List.voidsetPreviousTime(double previousTime) Sets the previous time when the scheduler updated the processing of the cloudlets it is managing.voidsetTaskScheduler(CloudletTaskScheduler taskScheduler) Sets theCloudletTaskSchedulerto process cloudlet tasks namely (i) sending or receivingVmPackets by the Vm assigned to the current CloudletScheduler, or (ii) scheduling execution tasks.voidSets the Vm that will use this scheduler.doubleupdateProcessing(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 forCloudletSchedulerobjects.
-
-
Method Details
-
cloudletFail
Sets a cloudlet as failed.- Parameters:
cloudlet- cloudlet to set as failed- Returns:
- the failed cloudlet or
Cloudlet.NULLif not found
-
cloudletCancel
Cancels the execution of a cloudlet.- Parameters:
cloudlet- the cloudlet being canceled- Returns:
- the canceled cloudlet or
Cloudlet.NULLif not found
-
cloudletReady
Sets the status of a Cloudlet toCloudlet.Status.READYso 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 the 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 to move the required files from the Datacenter 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 a 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
-
setPreviousTime
void setPreviousTime(double previousTime) Sets the previous time when the scheduler updated the processing of the cloudlets it is managing.- Parameters:
previousTime- the new previous time
-
getCloudletExecList
List<CloudletExecution> getCloudletExecList()- Returns:
- a read-only List of cloudlets being executed on the VM.
-
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.NOTE: 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
-
isCloudletSubmittedListEnabled
boolean isCloudletSubmittedListEnabled()Returns true or false if the list of all Cloudlets submitted so far is enabled. That indicates if the scheduler keeps a history of each submitted Cloudlet.- Returns:
- true or false if the list of all Cloudlets submitted so far is enabled
- See Also:
-
enableCloudletSubmittedList
CloudletScheduler enableCloudletSubmittedList()Enables the history of all Cloudlets submitted so far.- See Also:
-
getCloudletWaitingList
List<CloudletExecution> getCloudletWaitingList()- Returns:
- a read-only List of cloudlet waiting to be executed on the VM.
-
getCloudletList
-
getCloudletFinishedList
List<CloudletExecution> getCloudletFinishedList()- Returns:
- a list of finished cloudlets.
-
isEmpty
boolean isEmpty()Checks if there aren't cloudlets waiting or executing inside the Vm.- Returns:
- true if the scheduler has no cloudlets to execute or waiting to be executed; 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()- Returns:
- the previous time when the scheduler updated the processing of cloudlets it is managing.
-
getRequestedCpuPercent
double getRequestedCpuPercent(double time) Gets total CPU percentage requested (from MIPS capacity) from all cloudlets, according to CPUUtilizationModelof each Cloudlet.- Parameters:
time- the time to get the current CPU utilization- Returns:
- the total CPU percentage requested (in scale from 0 to 1, where 1 is 100%)
-
getAllocatedCpuPercent
double getAllocatedCpuPercent(double time) Gets total CPU utilization percentage allocated (from MIPS capacity) to all cloudlets, according to CPUUtilizationModelof each Cloudlet.- Parameters:
time- the time to get the current CPU utilization- Returns:
- the total CPU utilization percentage allocated (in scale from 0 to 1, where 1 is 100%).
-
hasFinishedCloudlets
boolean hasFinishedCloudlets()Informs if there is any cloudlet that finished executing in the VM managed by this scheduler.- Returns:
- true if there is at least one finished cloudlet; false otherwise
-
getTaskScheduler
CloudletTaskScheduler getTaskScheduler()Gets theCloudletTaskSchedulerto process cloudlet tasks namely (i) sending or receivingVmPackets by the Vm assigned to the current CloudletScheduler, or (ii) scheduling execution tasks.- Returns:
- the CloudletTaskScheduler for this CloudletScheduler,
or
CloudletTaskScheduler.NULLif this scheduler will not deal with packets' transmission.
-
setTaskScheduler
Sets theCloudletTaskSchedulerto process cloudlet tasks namely (i) sending or receivingVmPackets by the Vm assigned to the current CloudletScheduler, or (ii) scheduling execution tasks. 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
CloudletTaskSchedulerinterface for more details.- Parameters:
taskScheduler- the CloudletTaskScheduler to set for this CloudletScheduler, orCloudletTaskScheduler.NULLif this scheduler will not deal with packets' transmission.
-
isThereTaskScheduler
boolean isThereTaskScheduler()Checks if there is aCloudletTaskSchedulerassigned to this CloudletScheduler to enable tasks execution and dispatching packets from and to the Vm of this CloudletScheduler.- Returns:
- true if a CloudletTaskScheduler is assigned to this CloudletScheduler; false otherwise
-
getVm
Vm getVm()- Returns:
- the Vm that uses this scheduler.
-
setVm
Sets the Vm that will use this scheduler. It is not required to manually set a Vm for the scheduler, since aVmsets itself to the scheduler when the scheduler is assigned to the Vm.- Parameters:
vm- the Vm to set- Throws:
IllegalArgumentException- when the scheduler is already assigned to another Vm, since each Vm must have its own schedulerNullPointerException- when the vm parameter is null
-
getUsedPes
long getUsedPes()- Returns:
- the number of currently used
Pe's.
-
getFreePes
long getFreePes()- Returns:
- the number of
Pe's currently not being used.
-
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 aCloudletScheduleris not able to allocate the amount of resource aCloudletis requesting, due to lack of available capacity.- Parameters:
listener- the Listener to add- Returns:
- this scheduler
-
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
-