|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object Thread Sim_entity GridSimCore GridResource
public class GridResource
GridResource extends the GridSimCore
class for
gaining communication and concurrent entity capabilities.
An instance of this class simulates a resource
with properties defined in an object of
ResourceCharacteristics
class.
The process of creating a Grid resource is as follows:
A resource having a single machine with one or more PEs (Processing Elements) is managed as a time-shared system using a round-robin scheduling algorithm. A resource with multiple machines is treated as a distributed memory cluster and is managed as a space-shared system using FCFS (First Come Firt Serve) scheduling policy or its variants.
Since GridSim 2.2, other scheduling algorithm can be added externally (without compiling or replacing the existing GridSim JAR file) into a Grid resource. For more information, look on tutorial page or AllocPolicy class.
Since GridSim 3.0, different types of resources can be created externally without modifying this class. You need to do the following:
GridResource(String, double, ResourceCharacteristics,
ResourceCalendar, AllocPolicy)
registerOtherEntity()
method to register a
different entity or tag to GridInformationService
.
However, you also need to create a new child class extending from
GridInformationService
.
processOtherEvent(Sim_event)
method to process
other incoming tags apart from the standard ones.
body()
method if you do step 3.
Sim_entity
class.
Sim_entity
class.
Since GridSim 3.1, a network framework has been incorporated into this simulation. To make use of this, you need to create a resource entity only using the below constructors:
GridResource(String, Link, ResourceCharacteristics,
ResourceCalendar, AllocPolicy)
GridResource(String, Link, ResourceCharacteristics,
ResourceCalendar)
GridResource(String, Link, long,
ResourceCharacteristics, double, double, double,
LinkedList, LinkedList)
GridSimCore
,
ResourceCharacteristics
,
AllocPolicy
Nested Class Summary |
---|
Nested classes/interfaces inherited from class Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected AllocPolicy |
policy_
A resource's scheduler. |
protected int |
policyType_
A scheduler type of this resource, such as FCFS, Round Robin, etc |
protected String |
regionalGISName_
Regional GIS entity name |
protected ResourceCalendar |
resCalendar_
a ResourceCalendar object |
protected ResourceCharacteristics |
resource_
Characteristics of this resource |
protected static int |
SIZE
Integer object size, including its overhead |
Fields inherited from class GridSimCore |
---|
input, NETWORK_TYPE, output |
Fields inherited from class Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
GridResource(String name,
double baud_rate,
long seed,
ResourceCharacteristics resource,
double peakLoad,
double offPeakLoad,
double relativeHolidayLoad,
LinkedList weekends,
LinkedList holidays)
Allocates a new GridResource object. |
|
GridResource(String name,
double baud_rate,
ResourceCharacteristics resource,
ResourceCalendar calendar)
Allocates a new GridResource object. |
|
GridResource(String name,
double baud_rate,
ResourceCharacteristics resource,
ResourceCalendar calendar,
AllocPolicy policy)
Allocates a new GridResource object. |
|
GridResource(String name,
Link link,
long seed,
ResourceCharacteristics resource,
double peakLoad,
double offPeakLoad,
double relativeHolidayLoad,
LinkedList weekends,
LinkedList holidays)
Allocates a new GridResource object. |
|
GridResource(String name,
Link link,
ResourceCharacteristics resource,
ResourceCalendar calendar)
Allocates a new GridResource object. |
|
GridResource(String name,
Link link,
ResourceCharacteristics resource,
ResourceCalendar calendar,
AllocPolicy policy)
Allocates a new GridResource object. |
Method Summary | |
---|---|
void |
body()
Handles external events that are coming to this GridResource entity. |
AllocPolicy |
getAllocationPolicy()
Returns the allocation policy used by this Grid resource. |
ResourceCharacteristics |
getResourceCharacteristics()
Returns the characteristics of the resource. |
protected void |
processOtherEvent(Sim_event ev)
Overrides this method when making a new and different type of resource. |
protected void |
registerOtherEntity()
Overrides this method when making a new and different type of resource. |
boolean |
setRegionalGIS(AbstractGIS gis)
Sets a regional GridInformationService (GIS) entity for this resource to communicate with. |
boolean |
setRegionalGIS(String regionalGIS)
Sets a regional GridInformationService (GIS) entity for this resource to communicate with. |
Methods inherited from class GridSimCore |
---|
finalizeGridSimulation, getLink, getPingResult, isNetworked, ping, ping, ping, ping, pingBlockingCall, pingBlockingCall, pingBlockingCall, pingBlockingCall, send, send, send, send, send, send, setBackgroundTraffic, setBackgroundTraffic, terminateIOEntities |
Methods inherited from class Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ResourceCharacteristics resource_
protected ResourceCalendar resCalendar_
protected AllocPolicy policy_
protected int policyType_
protected static final int SIZE
protected String regionalGISName_
Constructor Detail |
---|
public GridResource(String name, double baud_rate, long seed, ResourceCharacteristics resource, double peakLoad, double offPeakLoad, double relativeHolidayLoad, LinkedList weekends, LinkedList holidays) throws Exception
GridResource(String, double, ResourceCharacteristics,
ResourceCalendar, AllocPolicy)
and then overrides processOtherEvent(Sim_event)
.
name
- the name to be associated with this entity (as
required by Sim_entity class from simjava package)baud_rate
- network communication or bandwidth speedseed
- the initial seedresource
- an object of ResourceCharacteristicspeakLoad
- the load during peak timesoffPeakLoad
- the load during off peak timesrelativeHolidayLoad
- the load during holiday timesweekends
- a linked-list contains the weekend daysholidays
- a linked-list contains the public holidays
Exception
- This happens when one of the following scenarios occur:
GridSim.init(int, Calendar, boolean, String[], String[],
String)
,
GridSim.init(int, Calendar, boolean)
,
GridResource(String, double,
ResourceCharacteristics, ResourceCalendar, AllocPolicy)
public GridResource(String name, double baud_rate, ResourceCharacteristics resource, ResourceCalendar calendar) throws Exception
GridResource(String, double, ResourceCharacteristics,
ResourceCalendar, AllocPolicy)
and then overrides processOtherEvent(Sim_event)
.
name
- the name to be associated with this entity (as
required by Sim_entity class from simjava package)baud_rate
- network communication or bandwidth speedresource
- an object of ResourceCharacteristicscalendar
- an object of ResourceCalendar
Exception
- This happens when one of the following scenarios occur:
GridSim.init(int, Calendar, boolean, String[], String[],
String)
,
GridSim.init(int, Calendar, boolean)
,
GridResource(String, double,
ResourceCharacteristics, ResourceCalendar, AllocPolicy)
public GridResource(String name, double baud_rate, ResourceCharacteristics resource, ResourceCalendar calendar, AllocPolicy policy) throws Exception
processOtherEvent(Sim_event)
.
name
- the name to be associated with this entity (as
required by Sim_entity class from simjava package)baud_rate
- network communication or bandwidth speedresource
- an object of ResourceCharacteristicscalendar
- an object of ResourceCalendarpolicy
- a scheduling policy for this Grid resource. If no
scheduling policy is defined, the default one is
SpaceShared
Exception
- This happens when one of the following scenarios occur:
GridSim.init(int, Calendar, boolean, String[], String[],
String)
,
GridSim.init(int, Calendar, boolean)
,
AllocPolicy
public GridResource(String name, Link link, long seed, ResourceCharacteristics resource, double peakLoad, double offPeakLoad, double relativeHolidayLoad, LinkedList weekends, LinkedList holidays) throws Exception
GridResource(String, Link, ResourceCharacteristics,
ResourceCalendar, AllocPolicy)
and then overrides processOtherEvent(Sim_event)
.
name
- the name to be associated with this entity (as
required by Sim_entity class from simjava package)link
- the link that will be used to connect this
GridResource to another Entity or Router.seed
- the initial seedresource
- an object of ResourceCharacteristicspeakLoad
- the load during peak timesoffPeakLoad
- the load during off peak timesrelativeHolidayLoad
- the load during holiday timesweekends
- a linked-list contains the weekend daysholidays
- a linked-list contains the public holidays
Exception
- This happens when one of the following scenarios occur:
GridSim.init(int, Calendar, boolean, String[], String[],
String)
public GridResource(String name, Link link, ResourceCharacteristics resource, ResourceCalendar calendar) throws Exception
GridResource(String, Link, ResourceCharacteristics,
ResourceCalendar, AllocPolicy)
and then overrides processOtherEvent(Sim_event)
.
name
- the name to be associated with this entity (as
required by Sim_entity class from simjava package)link
- the link that will be used to connect this
GridResource to another Entity or Router.resource
- an object of ResourceCharacteristicscalendar
- an object of ResourceCalendar
Exception
- This happens when one of the following scenarios occur:
GridSim.init(int, Calendar, boolean, String[], String[],
String)
public GridResource(String name, Link link, ResourceCharacteristics resource, ResourceCalendar calendar, AllocPolicy policy) throws Exception
processOtherEvent(Sim_event)
.
name
- the name to be associated with this entity (as
required by Sim_entity class from simjava package)link
- the link that will be used to connect this
GridResource to another Entity or Router.resource
- an object of ResourceCharacteristicscalendar
- an object of ResourceCalendarpolicy
- a scheduling policy for this Grid resource. If no
scheduling policy is defined, the default one is
SpaceShared
Exception
- This happens when one of the following scenarios occur:
GridSim.init(int, Calendar, boolean, String[], String[],
String)
,
AllocPolicy
Method Detail |
---|
public AllocPolicy getAllocationPolicy()
public ResourceCharacteristics getResourceCharacteristics()
public boolean setRegionalGIS(String regionalGIS)
GridInformationService
or
system GIS.
regionalGIS
- name of regional GIS entity
public boolean setRegionalGIS(AbstractGIS gis)
GridInformationService
or
system GIS.
gis
- regional GIS entity object
public void body()
The services or tags available for this resource are:
GridSimTags.RESOURCE_CHARACTERISTICS
GridSimTags.RESOURCE_DYNAMICS
GridSimTags.GRIDLET_SUBMIT
GridSimTags.GRIDLET_CANCEL
GridSimTags.GRIDLET_PAUSE
GridSimTags.GRIDLET_RESUME
GridSimTags.GRIDLET_MOVE
GridSimTags.GRIDLET_STATUS
registerOtherEntity()
method
processOtherEvent(Sim_event)
method
body
in class Sim_entity
protected void processOtherEvent(Sim_event ev)
body()
for incoming unknown tags.
Another approach is to override the
AllocPolicy.processOtherEvent(Sim_event)
method.
This approach is desirable if you do not want to create a new type of
grid resource.
ev
- a Sim_event objectprotected void registerOtherEntity()
body()
to register other type to
GridInformationService
entity. In doing so, you
need to create a new child class extending from
GridInformationService
.
body()
method, if
you use this method.
GridInformationService
|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |