GridSim 5.0 beta

gridsim.parallel
Class ResourceDynamics

Object
  extended by ResourceCharacteristics
      extended by ResourceDynamics

public class ResourceDynamics
extends ResourceCharacteristics

GridSim ResourceDynamics class represents static properties of a resource such as resource architecture, Operating System (OS), management policy (time-shared, space-shared, parallel-space-shared and parallel-space-shared with advance reservations), cost and time zone at which the resource is located along resource configuration.

NOTE: This class has been created to maintain the compatibility with the GridSim model in which the ResourceCharacteristics implements methods that return the number of PEs available, among other information.

Since:
5.0
Author:
Marcos Dias de Assuncao

Field Summary
 
Fields inherited from class ResourceCharacteristics
ADVANCE_RESERVATION, OTHER_POLICY_DIFFERENT_RATING, OTHER_POLICY_SAME_RATING, SPACE_SHARED, TIME_SHARED
 
Constructor Summary
ResourceDynamics(ResourceCharacteristics ch)
          Allocates a new ResourceDynamics object.
ResourceDynamics(String architecture, String os, MachineList machineList, int allocationPolicy, double timeZone, double costPerSec)
          Allocates a new ResourceDynamics object.
 
Method Summary
 PERangeList getFreePERanges()
          Returns the list of ranges of PEs available at the current simulation time
 LinkedList<Machine> getListMachineWithFreePE()
          Returns a list of machines with free PEs.
NOTE: Not supported.
 Machine getMachineWithFreePE()
          Gets a Machine with at least one empty PE
NOTE: Not supported.
 Machine getMachineWithFreePE(int numPE)
          Gets a Machine with at least a given number of free PE
NOTE: Not supported.
 int getMIPSRating()
          Gets the total MIPS rating, which is the sum of MIPS rating of all machines in a resource.
 int getNumBusyPE()
          Gets the total number of BUSY PEs for all Machines
 int getNumFreePE()
          Gets the total number of FREE or non-busy PEs for all Machines
 int getNumPE()
          Gets the total number of PEs for all Machines
 void resetFreePERanges()
          This method resets the ranges of PEs available.
 void resetFreePERanges(PERangeList ranges)
          Resets the ranges of PEs available and sets it to the list provided
 void setPEsAvailable(PERangeList ranges)
          Sets the status of a list of ranges of PEs to available
 void setPEsBusy(PERangeList ranges)
          Sets the status of a list of ranges of PEs to busy
 boolean setStatusPE(boolean status, int machineID, int peID)
          Sets the particular PE status on a Machine
NOTE: Not supported.
 
Methods inherited from class ResourceCharacteristics
getByteSize, getCostPerMI, getCostPerSec, getCPUTime, getMachineList, getMIPSRatingOfOnePE, getMIPSRatingOfOnePE, getNumFailedMachines, getNumMachines, getResourceAllocationPolicy, getResourceArch, getResourceID, getResourceName, getResourceOS, getResourceTimeZone, isWorking, setCostPerSec, setResourceID
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceDynamics

public ResourceDynamics(String architecture,
                        String os,
                        MachineList machineList,
                        int allocationPolicy,
                        double timeZone,
                        double costPerSec)
Allocates a new ResourceDynamics object. If the time zone is invalid, then by default, it will be GMT+0.

Parameters:
architecture - the architecture of a resource
os - the operating system used
machineList - list of machines in a resource
allocationPolicy - the resource allocation policy
timeZone - local time zone where the resource is. Time zone should be of range [GMT-12 ... GMT+13]
costPerSec - the cost per sec to use this resource
Pre Condition:
architecture != null, OS != null, machineList != null, allocationPolicy >= 0 && allocationPolicy <= 3, timeZone >= -12 && timeZone <= 13, costPerSec >= 0.0
Post Condition:
$none

ResourceDynamics

public ResourceDynamics(ResourceCharacteristics ch)
Allocates a new ResourceDynamics object.

Parameters:
ch - the original resource characteristics object.
Pre Condition:
ch != null
Method Detail

resetFreePERanges

public void resetFreePERanges()
This method resets the ranges of PEs available. That is, it sets all processing elements as available.


getMachineWithFreePE

public Machine getMachineWithFreePE()
Gets a Machine with at least one empty PE
NOTE: Not supported.

Overrides:
getMachineWithFreePE in class ResourceCharacteristics
Returns:
a Machine object or null if not found

getListMachineWithFreePE

public LinkedList<Machine> getListMachineWithFreePE()
Returns a list of machines with free PEs.
NOTE: Not supported.

Returns:
the list of machines with free PEs.

getMachineWithFreePE

public Machine getMachineWithFreePE(int numPE)
Gets a Machine with at least a given number of free PE
NOTE: Not supported.

Overrides:
getMachineWithFreePE in class ResourceCharacteristics
Parameters:
numPE - number of PE
Returns:
a Machine object or null if not found

getMIPSRating

public int getMIPSRating()
Gets the total MIPS rating, which is the sum of MIPS rating of all machines in a resource.

Overrides:
getMIPSRating in class ResourceCharacteristics
Returns:
the sum of MIPS ratings

getNumPE

public int getNumPE()
Gets the total number of PEs for all Machines

Overrides:
getNumPE in class ResourceCharacteristics
Returns:
number of PEs

getNumFreePE

public int getNumFreePE()
Gets the total number of FREE or non-busy PEs for all Machines

Overrides:
getNumFreePE in class ResourceCharacteristics
Returns:
number of PEs

getNumBusyPE

public int getNumBusyPE()
Gets the total number of BUSY PEs for all Machines

Overrides:
getNumBusyPE in class ResourceCharacteristics
Returns:
number of PEs

setPEsBusy

public void setPEsBusy(PERangeList ranges)
Sets the status of a list of ranges of PEs to busy

Parameters:
ranges - the list of ranges of PEs whose status has to be changed

setPEsAvailable

public void setPEsAvailable(PERangeList ranges)
Sets the status of a list of ranges of PEs to available

Parameters:
ranges - the list of ranges of PEs whose status has to be changed

resetFreePERanges

public void resetFreePERanges(PERangeList ranges)
Resets the ranges of PEs available and sets it to the list provided

Parameters:
ranges - the list of ranges available

getFreePERanges

public PERangeList getFreePERanges()
Returns the list of ranges of PEs available at the current simulation time

Returns:
a list of ranges of PEs available at the current simulation time

setStatusPE

public boolean setStatusPE(boolean status,
                           int machineID,
                           int peID)
Sets the particular PE status on a Machine
NOTE: Not supported.

Overrides:
setStatusPE in class ResourceCharacteristics
Parameters:
status - PE status, either PE.FREE or PE.BUSY
machineID - Machine ID
peID - PE id
Returns:
true if the PE status has changed, false otherwise (Machine id or PE id might not be exist)

GridSim 5.0 beta

The University of Melbourne, Australia, 2009