Interface CloudletScheduler

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
CloudletSchedulerAbstract, CloudletSchedulerCompletelyFair, CloudletSchedulerSpaceShared, CloudletSchedulerTimeShared

public interface CloudletScheduler
extends java.io.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 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 Details

  • Method Details

    • 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
    • cloudletCancel

      Cloudlet cloudletCancel​(Cloudlet cloudlet)
      Cancels execution of a cloudlet.
      Parameters:
      cloudlet - the cloudlet being canceled
      Returns:
      the canceled cloudlet or Cloudlet.NULL if not found
    • 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
    • cloudletPause

      boolean cloudletPause​(Cloudlet cloudlet)
      Pauses execution of a cloudlet.
      Parameters:
      cloudlet - the cloudlet being paused
      Returns:
      $true if cloudlet was paused, $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
    • getCloudletExecList

      java.util.List<CloudletExecution> getCloudletExecList()
      Gets a read-only List of cloudlets being executed on the VM.
      Returns:
      the cloudlet execution list
    • getCloudletWaitingList

      java.util.List<CloudletExecution> getCloudletWaitingList()
      Gets a read-only List of cloudlet waiting to be executed on the VM.
      Returns:
      the cloudlet waiting list
    • getCloudletList

      java.util.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
    • getCloudletFinishedList

      java.util.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​(int 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
    • 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
    • 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 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.
    • 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 CloudletTaskScheduler 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.
    • 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.
      Returns:
    • updateProcessing

      double updateProcessing​(double currentTime, java.util.List<java.lang.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
    • getVm

      Vm getVm()
      Gets the Vm that uses the scheduler.
      Returns:
    • 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:
      java.lang.IllegalArgumentException - when the scheduler already is assigned to another Vm, since each Vm must have its own scheduler
      java.lang.NullPointerException - when the vm parameter is null
    • getUsedPes

      long getUsedPes()
      Gets the number of currently used Pe's.
      Returns:
    • getFreePes

      long getFreePes()
      Gets the number of PEs currently not being used.
      Returns:
    • 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
    • clear

      void clear()
      Clears the internal state of the scheduler