CloudletScheduler

public interface CloudletScheduler extends Serializable

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 CloudletScheduler.NULL object instead of attributing null to CloudletScheduler variables.

Author:Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho

Fields

NULL

CloudletScheduler NULL

An attribute that implements the Null Object Design Pattern for CloudletScheduler objects.

Methods

addCloudletToReturnedList

void addCloudletToReturnedList(Cloudlet cloudlet)

Adds a Cloudlet to the list of finished Cloudlets that have been returned to its DatacenterBroker.

Parameters:
  • cloudlet – the Cloudlet to be added

cloudletCancel

Cloudlet cloudletCancel(Cloudlet cloudlet)

Cancels execution of a cloudlet.

Parameters:
  • cloudlet – ID of the cloudlet being canceled
Returns:

the canceled cloudlet or Cloudlet.NULL if not found

cloudletFail

Cloudlet cloudletFail(Cloudlet cloudlet)

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

cloudletFinish

void cloudletFinish(CloudletExecution cle)

Processes a finished cloudlet.

Parameters:
  • cle – finished cloudlet

cloudletPause

boolean cloudletPause(Cloudlet cloudlet)

Pauses execution of a cloudlet.

Parameters:
  • cloudlet – the cloudlet being paused
Returns:

$true if cloudlet was paused, $false otherwise

cloudletReady

boolean cloudletReady(Cloudlet cloudlet)

Sets the status of a Cloudlet to Cloudlet.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

cloudletResume

double cloudletResume(Cloudlet cloudlet)

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

double cloudletSubmit(Cloudlet cloudlet, double fileTransferTime)

Receives a cloudlet to be executed in the VM managed by this scheduler.

Parameters:
  • cloudlet – the submitted cloudlet
  • fileTransferTime – 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

double cloudletSubmit(Cloudlet cloudlet)

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

deallocatePesFromVm

void deallocatePesFromVm(int pesToRemove)

Releases a given number of PEs from a VM.

Parameters:
  • pesToRemove – number of PEs to deallocate

getCloudletExecList

List<CloudletExecution> getCloudletExecList()

Gets a read-only List of cloudlets being executed on the VM.

Returns:the cloudlet execution list

getCloudletFinishedList

List<CloudletExecution> getCloudletFinishedList()

Gets a list of finished cloudlets.

Returns:the cloudlet finished list

getCloudletList

List<Cloudlet> 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

getCloudletReturnedList

Set<Cloudlet> getCloudletReturnedList()

Gets a read-only list of Cloudlets that finished executing and were returned the their broker. A Cloudlet is returned to to notify the broker about the end of its execution.

getCloudletStatus

int getCloudletStatus(int cloudletId)

Gets the status of a cloudlet with a given id.

Parameters:
  • cloudletId – ID of the cloudlet to get the status
Returns:

status of the cloudlet if it was found, otherwise, returns -1

getCloudletToMigrate

Cloudlet getCloudletToMigrate()

Returns one cloudlet to migrate to another Vm. How the migrating cloudlet is select is defined by each class implementing this interface.

Returns:one running cloudlet

getCloudletWaitingList

List<CloudletExecution> getCloudletWaitingList()

Gets a read-only List of cloudlet waiting to be executed on the VM.

Returns:the cloudlet waiting list

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%)

getFreePes

long getFreePes()

Gets the number of PEs currently not being used.

getPreviousTime

double getPreviousTime()

Gets the previous time when the scheduler updated the processing of cloudlets it is managing.

Returns:the previous time

getRequestedCpuPercentUtilization

double getRequestedCpuPercentUtilization(double time)

Gets total CPU utilization percentage of 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

getRequestedMipsForCloudlet

double getRequestedMipsForCloudlet(CloudletExecution cle, double time)

Gets the current requested MIPS for a given cloudlet.

Parameters:
  • cle – the ce
  • time – the time
Returns:

the current requested mips for the given cloudlet

getTaskScheduler

CloudletTaskScheduler getTaskScheduler()

Gets the CloudletTaskScheduler that will be used by this CloudletScheduler to process VmPackets 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.

getUsedPes

long getUsedPes()

Gets the number of currently used Pe’s.

getVm

Vm getVm()

Gets the Vm that uses the scheduler.

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

isCloudletReturned

boolean isCloudletReturned(Cloudlet cloudlet)

Checks if a Cloudlet has finished and was returned to its DatacenterBroker.

Parameters:
  • cloudlet – the Cloudlet to be checked
Returns:

true if the Cloudlet has finished and was returned to the broker, falser otherwise

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.

isThereTaskScheduler

boolean isThereTaskScheduler()

Checks if there is a CloudletTaskScheduler assigned to this CloudletScheduler in order to enable tasks execution and dispatching packets from and to the Vm of this CloudletScheduler.

runningCloudletsNumber

int runningCloudletsNumber()

Returns the number of cloudlets running in the virtual machine.

Returns:number of cloudlets running

setTaskScheduler

void setTaskScheduler(CloudletTaskScheduler taskScheduler)

Sets the CloudletTaskScheduler that will be used by this CloudletScheduler to process VmPackets 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 interface for more details.

Parameters:
  • taskScheduler – the CloudletTaskScheduler to set for this CloudletScheduler or CloudletTaskScheduler.NULL if this scheduler will not deal with packets transmission.

setVm

void setVm(Vm vm)

Sets the Vm that will use the scheduler. It is not required to manually set a Vm for the scheduler, since a Vm sets itself to the scheduler when the scheduler is assigned to the Vm.

Parameters:
  • vm – the Vm to set
Throws:

updateProcessing

double updateProcessing(double currentTime, List<Double> mipsShare)

Updates the processing of cloudlets inside the Vm running under management of this scheduler.

Parameters:
  • currentTime – current simulation time
  • mipsShare – list with MIPS share of each Pe available to the scheduler
Returns:

the predicted completion time of the earliest finishing cloudlet (which is a relative delay from the current simulation time), or Double.MAX_VALUE if there is no next Cloudlet to execute