GridSim 5.0 beta

gridsim
Class ResourceCharacteristics

Object
  extended by ResourceCharacteristics
Direct Known Subclasses:
ResourceDynamics

public class ResourceCharacteristics
extends Object

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

Since:
GridSim Toolkit 1.0
Author:
Manzur Murshed and Rajkumar Buyya
Invariant:
$none

Field Summary
static int ADVANCE_RESERVATION
          A resource that supports Advanced Reservation mechanisms.
static int OTHER_POLICY_DIFFERENT_RATING
          Assuming all PEs in a Machine have the same rating.
static int OTHER_POLICY_SAME_RATING
          Assuming all PEs in all Machines have the same rating.
static int SPACE_SHARED
          Spaced-shared system using First Come First Serve (FCFS) algorithm
static int TIME_SHARED
          Time-shared system using Round-Robin algorithm
 
Constructor Summary
ResourceCharacteristics(String architecture, String OS, MachineList machineList, int allocationPolicy, double timeZone, double costPerSec)
          Allocates a new ResourceCharacteristics object.
 
Method Summary
 int getByteSize()
          Gets the byte size of this class
 double getCostPerMI()
          Gets the cost per Millions Instruction (MI) associated with a resource
 double getCostPerSec()
          Gets the cost per second associated with a resource
 double getCPUTime(double gridletLength, double load)
          Gets the CPU time given the specified parameters (only for TIME_SHARED).
 MachineList getMachineList()
          Gets the list of machines in a resouce
 Machine getMachineWithFreePE()
          Gets a Machine with at least one empty PE
 Machine getMachineWithFreePE(int numPE)
          Gets a Machine with at least a given number of free PE
 int getMIPSRating()
          Gets the total MIPS rating, which is the sum of MIPS rating of all machines in a resource.
 int getMIPSRatingOfOnePE()
          Gets Millions Instructions Per Second (MIPS) Rating of a Processing Element (PE).
 int getMIPSRatingOfOnePE(int id, int peID)
          Gets Millions Instructions Per Second (MIPS) Rating of a Processing Element (PE).
 int getNumBusyPE()
          Gets the total number of BUSY PEs for all Machines
 int getNumFailedMachines()
          Gets the current number of failed machines.
 int getNumFreePE()
          Gets the total number of FREE or non-busy PEs for all Machines
 int getNumMachines()
          Gets the total number of machines.
 int getNumPE()
          Gets the total number of PEs for all Machines
 int getResourceAllocationPolicy()
          Gets the resource allocation policy
 String getResourceArch()
          Gets the resource architecture name
 int getResourceID()
          Gets the resource ID
 String getResourceName()
          Gets the name of a resource
 String getResourceOS()
          Gets the Operating System (OS) this resource is used
 double getResourceTimeZone()
          Gets the resource time zone
 boolean isWorking()
          Checks whether all machines of this resource are working properly or not.
 void setCostPerSec(double costPerSec)
          Sets the cost per second associated with a resource
 void setResourceID(int id)
          Sets the resource ID
 boolean setStatusPE(boolean status, int machineID, int peID)
          Sets the particular PE status on a Machine
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIME_SHARED

public static final int TIME_SHARED
Time-shared system using Round-Robin algorithm

See Also:
Constant Field Values

SPACE_SHARED

public static final int SPACE_SHARED
Spaced-shared system using First Come First Serve (FCFS) algorithm

See Also:
Constant Field Values

OTHER_POLICY_SAME_RATING

public static final int OTHER_POLICY_SAME_RATING
Assuming all PEs in all Machines have the same rating.

See Also:
Constant Field Values

OTHER_POLICY_DIFFERENT_RATING

public static final int OTHER_POLICY_DIFFERENT_RATING
Assuming all PEs in a Machine have the same rating. However, each Machine has different rating to each other.

See Also:
Constant Field Values

ADVANCE_RESERVATION

public static final int ADVANCE_RESERVATION
A resource that supports Advanced Reservation mechanisms.

See Also:
Constant Field Values
Constructor Detail

ResourceCharacteristics

public ResourceCharacteristics(String architecture,
                               String OS,
                               MachineList machineList,
                               int allocationPolicy,
                               double timeZone,
                               double costPerSec)
Allocates a new ResourceCharacteristics 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 of a user that owns this reservation. 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
Method Detail

setResourceID

public void setResourceID(int id)
Sets the resource ID

Parameters:
id - the resource ID
Pre Condition:
id >= 0
Post Condition:
$none

getResourceID

public int getResourceID()
Gets the resource ID

Returns:
the resource ID
Pre Condition:
$none
Post Condition:
$result >= 0

getResourceName

public String getResourceName()
Gets the name of a resource

Returns:
the resource name
Pre Condition:
$none
Post Condition:
$result != null

getResourceArch

public String getResourceArch()
Gets the resource architecture name

Returns:
the architecture name
Pre Condition:
$none
Post Condition:
$result != null

getResourceOS

public String getResourceOS()
Gets the Operating System (OS) this resource is used

Returns:
the name of OS
Pre Condition:
$none
Post Condition:
$result != null

getMachineList

public MachineList getMachineList()
Gets the list of machines in a resouce

Returns:
a MachineList object
See Also:
MachineList
Pre Condition:
$none
Post Condition:
$result != null

getMachineWithFreePE

public Machine getMachineWithFreePE()
Gets a Machine with at least one empty PE

Returns:
a Machine object or null if not found
Pre Condition:
$none
Post Condition:
$none

getMachineWithFreePE

public Machine getMachineWithFreePE(int numPE)
Gets a Machine with at least a given number of free PE

Parameters:
numPE - number of PE
Returns:
a Machine object or null if not found
Pre Condition:
$none
Post Condition:
$none

getResourceAllocationPolicy

public int getResourceAllocationPolicy()
Gets the resource allocation policy

Returns:
the allocation policy
Pre Condition:
$none
Post Condition:
$result >= 0 && $result <= 2

getResourceTimeZone

public double getResourceTimeZone()
Gets the resource time zone

Returns:
the time zone
Pre Condition:
$none
Post Condition:
$none

getMIPSRatingOfOnePE

public int getMIPSRatingOfOnePE()
Gets Millions Instructions Per Second (MIPS) Rating of a Processing Element (PE). It is assumed all PEs' rating is same in a given machine.

Returns:
the MIPS Rating or -1 if no PEs are exists.
Pre Condition:
$none
Post Condition:
$result >= -1

getMIPSRatingOfOnePE

public int getMIPSRatingOfOnePE(int id,
                                int peID)
Gets Millions Instructions Per Second (MIPS) Rating of a Processing Element (PE). It is essential to use this method when a resource is made up of heterogenous PEs/machines.

Parameters:
id - the machine ID
peID - the PE ID
Returns:
the MIPS Rating or -1 if no PEs are exists.
Pre Condition:
id >= 0, peID >= 0
Post Condition:
$result >= -1

getMIPSRating

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

Total MIPS rating for:

Returns:
the sum of MIPS ratings
Pre Condition:
$none
Post Condition:
$result >= 0

getCPUTime

public double getCPUTime(double gridletLength,
                         double load)
Gets the CPU time given the specified parameters (only for TIME_SHARED). NOTE: The CPU time for SPACE_SHARED and ADVANCE_RESERVATION are not yet implemented.

Parameters:
gridletLength - the length of a Gridlet
load - the load of a Gridlet
Returns:
the CPU time
Pre Condition:
gridletLength >= 0.0, load >= 0.0
Post Condition:
$result >= 0.0

getNumPE

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

Returns:
number of PEs
Pre Condition:
$none
Post Condition:
$result >= 0

getNumFreePE

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

Returns:
number of PEs
Pre Condition:
$none
Post Condition:
$result >= 0

getNumBusyPE

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

Returns:
number of PEs
Pre Condition:
$none
Post Condition:
$result >= 0

setStatusPE

public boolean setStatusPE(boolean status,
                           int machineID,
                           int peID)
Sets the particular PE status on a Machine

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)
Pre Condition:
machineID >= 0, peID >= 0
Post Condition:
$none

setCostPerSec

public void setCostPerSec(double costPerSec)
Sets the cost per second associated with a resource

Parameters:
costPerSec - the cost using a resource
Pre Condition:
costPerSec >= 0.0
Post Condition:
$none

getCostPerSec

public double getCostPerSec()
Gets the cost per second associated with a resource

Returns:
the cost using a resource
Pre Condition:
$none
Post Condition:
$result >= 0.0

getCostPerMI

public double getCostPerMI()
Gets the cost per Millions Instruction (MI) associated with a resource

Returns:
the cost using a resource
Pre Condition:
$none
Post Condition:
$result >= 0.0

getByteSize

public int getByteSize()
Gets the byte size of this class

Returns:
the byte size
Pre Condition:
$none
Post Condition:
$result > 0

getNumMachines

public int getNumMachines()
Gets the total number of machines.

Returns:
total number of machines this resource has.

getNumFailedMachines

public int getNumFailedMachines()
Gets the current number of failed machines.

Returns:
current number of failed machines this resource has.

isWorking

public boolean isWorking()
Checks whether all machines of this resource are working properly or not.

Returns:
true if all machines are working, false otherwise

GridSim 5.0 beta

The University of Melbourne, Australia, 2009