GridSim 5.0 beta

gridsim.parallel
Class SSGridlet

Object
  extended by SSGridlet
All Implemented Interfaces:
ScheduleItem

public class SSGridlet
extends Object
implements ScheduleItem

SSGridlet represents a Gridlet submitted to a ParallelResource for processing (i.e. Server Side). This class keeps track of the time for all activities in the ParallelResource for a specific Gridlet. Before a Gridlet exits the GridResource, it is RECOMMENDED to call this method finalizeGridlet().

It contains a Gridlet object along with its arrival time and the ranges of PEs (Processing Element) allocated to it.

Since:
5.0
Author:
Marcos Dias de Assuncao

Field Summary
 
Fields inherited from interface ScheduleItem
TIME_UNIT_HOUR, TIME_UNIT_MINUTE, TIME_UNIT_SECOND
 
Constructor Summary
  SSGridlet(Gridlet gridlet)
          Allocates a new object upon the arrival of a Gridlet object.
protected SSGridlet(SSGridlet original)
          Creates a clone of the original gridlet object.
 
Method Summary
 void finalizeGridlet()
          Finalises all relevant information before exiting the GridResource entity.
 double getActualFinishTime()
          Gets the Gridlet's finish time
 double getArrivalTime()
          Gets arrival time of a gridlet
 int getClassType()
          Gets the Gridlet's class type
 double getExecStartTime()
          Gets the Gridlet's execution start time
 double getExpectedFinishTime()
          Gets the gridlet's expected finish time.
 Gridlet getGridlet()
          Gets this Gridlet object
 int getID()
          Gets this Gridlet entity Id
 double getLength()
          Gets the Gridlet's length
 int getNumPE()
          Gets the number of PEs required to execute this Gridlet.
 int getPartitionID()
          Gets the id of the partition or queue to which this gridlet was scheduled
 PERangeList getPERangeList()
          Gets the list of ranges of PEs used by this Gridlet
 int getPriority()
          Gets the priority of this gridlet assigned by the scheduler
 double getRemainingLength()
          Gets the remaining gridlet length
 int getReservationID()
          Gets the reservation ID that owns this Gridlet
 int getSenderID()
          Gets the user or owner of this Gridlet
 double getStartTime()
          Gets the time that a Gridlet is supposed to start.
 int getStatus()
          Gets the Gridlet status
 double getSubmissionTime()
          Gets the submission or arrival time of this Gridlet from the latest GridResource
 boolean hasReserved()
          Checks whether this Gridlet is submitted by reserving or not.
 boolean isAdvanceReservation()
          Checks if this object is an advance reservation or not
 void setActualFinishTime(double time)
          Sets the actual finish time for this Gridlet.
 void setExpectedFinishTime(double time)
          Sets the item's expected finish time.
 boolean setPartitionID(int partition)
          Sets the id of the partition or queue to which this gridlet was scheduled
 void setPERangeList(PERangeList rangeList)
          Sets the ranges of PEs used by this Gridlet
 boolean setPriority(int priority)
          Sets the priority of this gridlet assigned by the scheduler
 void setStartTime(double startTime)
          Sets the time that a Gridlet is supposed to start.
 boolean setStatus(int status)
          Sets the Gridlet status.
 String toString()
          Creates a String representation of this Gridlet for debugging purposes
 String toString(int timeUnit)
          Creates a String representation of this Gridlet for displaying purposes
 void updateGridletFinishedSoFar(double miLength)
          A method that updates the length of gridlet that has been completed
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SSGridlet

public SSGridlet(Gridlet gridlet)
Allocates a new object upon the arrival of a Gridlet object. The arriving time is determined by GridSim.clock().

Parameters:
gridlet - a gridlet object
See Also:
GridSim.clock()
Pre Condition:
gridlet != null
Post Condition:
$none

SSGridlet

protected SSGridlet(SSGridlet original)
Creates a clone of the original gridlet object. The Gridlet object is not copied.

Parameters:
original - the original object
Method Detail

getStartTime

public double getStartTime()
Gets the time that a Gridlet is supposed to start. That is, the allocation policy may decide to start the execution of this Gridlet at a particular time in the future. The potential start time represents this time.

Specified by:
getStartTime in interface ScheduleItem
Returns:
the potential start time

setStartTime

public void setStartTime(double startTime)
Sets the time that a Gridlet is supposed to start. That is, the allocation policy may decide to start the execution of this Gridlet at a particular time in the future. The potential start time represents this time.

Parameters:
startTime - the potential start time

getNumPE

public int getNumPE()
Gets the number of PEs required to execute this Gridlet.

Specified by:
getNumPE in interface ScheduleItem
Returns:
number of PE
Pre Condition:
$none
Post Condition:
$none

getReservationID

public int getReservationID()
Gets the reservation ID that owns this Gridlet

Returns:
a reservation ID
Pre Condition:
$none
Post Condition:
$none

hasReserved

public boolean hasReserved()
Checks whether this Gridlet is submitted by reserving or not.

Specified by:
hasReserved in interface ScheduleItem
Returns:
true if this Gridlet has reserved before, false otherwise
Pre Condition:
$none
Post Condition:
$none

isAdvanceReservation

public boolean isAdvanceReservation()
Checks if this object is an advance reservation or not

Specified by:
isAdvanceReservation in interface ScheduleItem
Returns:
false indicating that it is not

getID

public int getID()
Gets this Gridlet entity Id

Specified by:
getID in interface ScheduleItem
Returns:
the Gridlet entity Id
Pre Condition:
$none
Post Condition:
$none

getSenderID

public int getSenderID()
Gets the user or owner of this Gridlet

Specified by:
getSenderID in interface ScheduleItem
Returns:
the Gridlet's user Id
Pre Condition:
$none
Post Condition:
$none

getLength

public double getLength()
Gets the Gridlet's length

Returns:
Gridlet's length
Pre Condition:
$none
Post Condition:
$none

getClassType

public int getClassType()
Gets the Gridlet's class type

Returns:
class type of the Gridlet
Pre Condition:
$none
Post Condition:
$none

setStatus

public boolean setStatus(int status)
Sets the Gridlet status.

Parameters:
status - the Gridlet status
Returns:
true if the new status has been set, false otherwise
Pre Condition:
status >= 0
Post Condition:
$none

getExecStartTime

public double getExecStartTime()
Gets the Gridlet's execution start time

Returns:
Gridlet's execution start time
Pre Condition:
$none
Post Condition:
$none

setPERangeList

public void setPERangeList(PERangeList rangeList)
Sets the ranges of PEs used by this Gridlet

Parameters:
rangeList - the range of PEs
Pre Condition:
rangeList != null

getPERangeList

public PERangeList getPERangeList()
Gets the list of ranges of PEs used by this Gridlet

Specified by:
getPERangeList in interface ScheduleItem
Returns:
a list containing the ranges

getPartitionID

public int getPartitionID()
Gets the id of the partition or queue to which this gridlet was scheduled

Specified by:
getPartitionID in interface ScheduleItem
Returns:
the partition id or -1 if not found

setPartitionID

public boolean setPartitionID(int partition)
Sets the id of the partition or queue to which this gridlet was scheduled

Parameters:
partition - the partition id
Returns:
true if set correctly or false otherwise.

getPriority

public int getPriority()
Gets the priority of this gridlet assigned by the scheduler

Specified by:
getPriority in interface ScheduleItem
Returns:
the priority or -1 if not found

setPriority

public boolean setPriority(int priority)
Sets the priority of this gridlet assigned by the scheduler

Parameters:
priority - the priority
Returns:
true if set correctly or false otherwise.

getRemainingLength

public double getRemainingLength()
Gets the remaining gridlet length

Returns:
gridlet length
Pre Condition:
$none
Post Condition:
$result >= 0

finalizeGridlet

public void finalizeGridlet()
Finalises all relevant information before exiting the GridResource entity. This method sets the final data of:

Pre Condition:
$none
Post Condition:
$none

updateGridletFinishedSoFar

public void updateGridletFinishedSoFar(double miLength)
A method that updates the length of gridlet that has been completed

Parameters:
miLength - gridlet length in Million Instructions (MI)
Pre Condition:
miLength >= 0.0
Post Condition:
$none

getArrivalTime

public double getArrivalTime()
Gets arrival time of a gridlet

Returns:
arrival time
Pre Condition:
$none
Post Condition:
$result >= 0.0

getSubmissionTime

public double getSubmissionTime()
Gets the submission or arrival time of this Gridlet from the latest GridResource

Specified by:
getSubmissionTime in interface ScheduleItem
Returns:
the submission time or 0.0 if none

setActualFinishTime

public void setActualFinishTime(double time)
Sets the actual finish time for this Gridlet. That is, the time when the gridlet will finish. If time is negative, then it is being ignored.

Parameters:
time - finish time
Pre Condition:
time >= 0.0
Post Condition:
$none

setExpectedFinishTime

public void setExpectedFinishTime(double time)
Sets the item's expected finish time. That is, this end time is based on the estimate provided by the user and may not reflect the actual finish time of the schedule item.

Parameters:
time - the expected finish time
Pre Condition:
time >= 0.0
Post Condition:
$none

getActualFinishTime

public double getActualFinishTime()
Gets the Gridlet's finish time

Specified by:
getActualFinishTime in interface ScheduleItem
Returns:
finish time of a gridlet or -1.0 if it cannot finish in this hourly slot

getExpectedFinishTime

public double getExpectedFinishTime()
Gets the gridlet's expected finish time. That is, this end time is based on the estimate provided by the user and may not reflect the actual finish time of the schedule item.

Specified by:
getExpectedFinishTime in interface ScheduleItem
Returns:
finish time of an item or equals to the actual finish time if not known.

getGridlet

public Gridlet getGridlet()
Gets this Gridlet object

Returns:
gridlet object
Pre Condition:
$none
Post Condition:
$result != null

getStatus

public int getStatus()
Gets the Gridlet status

Specified by:
getStatus in interface ScheduleItem
Returns:
Gridlet status
Pre Condition:
$none
Post Condition:
$none

toString

public String toString()
Creates a String representation of this Gridlet for debugging purposes

Overrides:
toString in class Object
Returns:
a string

toString

public String toString(int timeUnit)
Creates a String representation of this Gridlet for displaying purposes

Specified by:
toString in interface ScheduleItem
Parameters:
timeUnit - the time unit to be used
Returns:
a string
See Also:
ScheduleItem.TIME_UNIT_SECOND, ScheduleItem.TIME_UNIT_MINUTE, ScheduleItem.TIME_UNIT_HOUR

GridSim 5.0 beta

The University of Melbourne, Australia, 2009