Class PeSimple

All Implemented Interfaces:
ChangeableId, Identifiable, Pe, Resource, ResourceCapacity, ResourceManageable

public class PeSimple extends ResourceManageableAbstract implements Pe
Pe (Processing Element) class represents a CPU core of a physical machine (PM), defined in terms of Millions Instructions Per Second (MIPS) rating. Such a class allows managing the Pe capacity and allocation.

ASSUMPTION: All PEs under the same Machine have the same MIPS rating.

Since:
CloudSim Toolkit 1.0
Author:
Manzur Murshed, Rajkumar Buyya
To do something:
This assumption is not being assured on different classes (where other TODOs were included)
  • Constructor Details

    • PeSimple

      public PeSimple()
      Instantiates a PE object with the default MIPS capacity and using a PeProvisionerSimple. The id of the PE is just set when a List of PEs is assigned to a Host.
      See Also:
    • PeSimple

      public PeSimple(double mipsCapacity)
      Instantiates a PE object using a PeProvisionerSimple. The id of the PE is just set when a List of PEs is assigned to a Host.
      Parameters:
      mipsCapacity - the capacity of the PE in MIPS (Million Instructions per Second)
      See Also:
    • PeSimple

      public PeSimple(double mipsCapacity, PeProvisioner peProvisioner)
      Instantiates a PE object. The id of the PE is just set when a List of PEs is assigned to a Host.
      Parameters:
      mipsCapacity - the capacity of the PE in MIPS (Million Instructions per Second)
      peProvisioner - the provisioner that will manage the allocation of this physical Pe for VMs
      See Also:
    • PeSimple

      public PeSimple(int id, double mipsCapacity, PeProvisioner peProvisioner)
      Instantiates a PE object defining a given id. The id of the PE is just set when a List of PEs is assigned to a Host.
      Parameters:
      id - the PE id
      mipsCapacity - the capacity of the PE in MIPS (Million Instructions per Second)
      peProvisioner - the provisioner that will manage the allocation of this physical Pe for VMs
      See Also:
  • Method Details

    • getDefaultMips

      public static double getDefaultMips()
      Gets the default MIPS capacity to be used to create PEs when the no-args constructor is used.
      Returns:
    • setDefaultMips

      public static void setDefaultMips(double defaultMips)
      Sets the default MIPS capacity to be used to create PEs when the no-args constructor is used.
      Parameters:
      defaultMips - the new default MIPS capacity to set
    • setId

      public final void setId(long id)
      Description copied from interface: ChangeableId
      Sets the id of the object. -1 indicates the object has no id.
      Specified by:
      setId in interface ChangeableId
      Parameters:
      id - the id to set
    • getId

      public long getId()
      Specified by:
      getId in interface Identifiable
    • getStatus

      public Pe.Status getStatus()
      Description copied from interface: Pe
      Gets the status of the PE.
      Specified by:
      getStatus in interface Pe
      Returns:
      the PE status
    • setStatus

      public final boolean setStatus(Pe.Status status)
      Description copied from interface: Pe
      Sets the status of the PE.
      Specified by:
      setStatus in interface Pe
      Parameters:
      status - the new PE status
      Returns:
      true if the status was set, false otherwise
    • setCapacity

      public boolean setCapacity(double mipsCapacity)
      Description copied from interface: Pe
      Sets the capacity of this Pe in MIPS (Million Instructions Per Second).

      It receives the amount of MIPS as a double value but converts it internally to a long. The method is just provided as a handy-way to define the PE capacity using a double value that usually is generated from some computations.

      If you want to have an idea of the MIPS capacity for different processors, check the link above.
      Specified by:
      setCapacity in interface Pe
      Parameters:
      mipsCapacity - the MIPS capacity to set
      Returns:
      true if mipsCapacity is greater than 0, false otherwise
    • setPeProvisioner

      public final Pe setPeProvisioner(PeProvisioner peProvisioner)
      Description copied from interface: Pe
      Sets the Pe.getPeProvisioner() that manages the allocation of this physical PE to virtual machines. This method is automatically called when a PeProvisioner is created passing a Pe instance. Thus, the PeProvisioner for a Pe doesn't have to be set manually.
      Specified by:
      setPeProvisioner in interface Pe
      Parameters:
      peProvisioner - the new PE provisioner
      Returns:
    • getPeProvisioner

      public PeProvisioner getPeProvisioner()
      Gets the PE provisioner that manages the allocation of this physical PE to virtual machines.
      Specified by:
      getPeProvisioner in interface Pe
      Returns:
      the PE provisioner
    • toString

      public String toString()
      Overrides:
      toString in class ResourceManageableAbstract
    • isWorking

      public boolean isWorking()
      Description copied from interface: Pe
      Checks if the PE is working (not failed).
      Specified by:
      isWorking in interface Pe
      Returns:
    • isFailed

      public boolean isFailed()
      Description copied from interface: Pe
      Checks if the PE is failed.
      Specified by:
      isFailed in interface Pe
      Returns:
    • isFree

      public boolean isFree()
      Description copied from interface: Pe
      Checks if the PE is free to be used (it's idle).
      Specified by:
      isFree in interface Pe
      Returns:
    • isBusy

      public boolean isBusy()
      Description copied from interface: Pe
      Checks if the PE is busy to be used (it's being used).
      Specified by:
      isBusy in interface Pe
      Returns: