Interface CloudletScheduler

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

public interface CloudletScheduler extends Serializable
An interface to be implemented by each class that provides a policy of scheduling performed by a Vm to run its Cloudlets. Each VM must have its own instance of a CloudletScheduler.
Since:
CloudSim Plus 1.0
Author:
Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
  • Field Details

    • LOGGER

      static final org.slf4j.Logger LOGGER
    • NULL

      static final CloudletScheduler NULL
      An attribute that implements the Null Object Design Pattern for CloudletScheduler objects.
  • Method Details

    • cloudletFail

      Cloudlet cloudletFail(Cloudlet cloudlet)
      Sets a cloudlet as failed.
      Parameters:
      cloudlet - cloudlet to set as failed
      Returns:
      the failed cloudlet or Cloudlet.NULL if not found
    • cloudletCancel

      Cloudlet cloudletCancel(Cloudlet cloudlet)
      Cancels the 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 the 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 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

      double cloudletSubmit(Cloudlet cloudlet)
      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

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

      List<Cloudlet> getCloudletList()
      Returns:
      a read-only List of all cloudlets that are either waiting or executing on the VM.
    • 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 CPU UtilizationModel of 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 CPU UtilizationModel of 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 the CloudletTaskScheduler to process cloudlet tasks namely (i) sending or receiving VmPackets by the Vm assigned to the current CloudletScheduler, or (ii) scheduling execution tasks.
      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 to process cloudlet tasks namely (i) sending or receiving VmPackets 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 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 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
    • updateProcessing

      double updateProcessing(double currentTime, MipsShare mipsShare)
      Updates the processing of cloudlets inside the Vm running under management of this scheduler.
      Parameters:
      currentTime - current simulation time
      mipsShare - MIPS share of each Pe available to the scheduler
      Returns:
      the next time to update cloudlets processing (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()
      Returns:
      the Vm that uses this scheduler.
    • setVm

      void setVm(Vm vm)
      Sets the Vm that will use this 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:
      IllegalArgumentException - when the scheduler is already assigned to another Vm, since each Vm must have its own scheduler
      NullPointerException - 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

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

      CloudletScheduler addOnCloudletResourceAllocationFail(EventListener<CloudletResourceAllocationFailEventInfo> listener)
      Adds a listener object that will be notified every time a CloudletScheduler is not able to allocate the amount of resource a Cloudlet is 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