GridSim
v3.0

gridsim
Class GridSimCore

Object
  extended byThread
      extended byeduni.simjava.Sim_entity
          extended bygridsim.GridSimCore
All Implemented Interfaces:
Cloneable, Runnable
Direct Known Subclasses:
GridInformationService, GridResource, GridSim, GridSimShutdown

public class GridSimCore
extends Sim_entity

Since GridSim version 3.0, this is the overall class of GridSim package, that must be extended by other GridSim entities. It inherits event management and threaded entity features from the eduni.simjava.Sim_entity class. This class adds networking and event delivery features, which allow synchronous or asynchronous communication for service access or delivery.

All classes that extend this class can implement a method called body(), which is automatically invoked since it is expected to be responsible for simulating entity behavior. body() method is the place to receive incoming events.

The entities that extend this class can be instantiated with or without networked I/O ports. A networked GridSim entity gains communication capability via the objects of GridSim's I/O entity classes, Input and Output classes. Each I/O entity will have a unique name assuming each GridSim entity that the user creates has a unique name. For example, a resource entity with the name Resource2, will have an input entity whose name is prefixed with Input_, making the input entity's full name Input_Resource2, which is expected to be unique. Input_Resource2 entity handles all incoming events. A resource has an output entity whose name is prefixed with Output_, e.g. Output_Resource2. Output_Resource2 entity handles all outgoing events.

The I/O entities are concurrent entities, but they are visible within the GridSim entity and are able to communicate with other GridSim entities by sending messages.

There are two ways to send a message or object to an entity, i.e. with or without I/O port. Below shows the differences:

Since:
GridSim Toolkit 3.0
Version:
3.0, May 2004
Author:
Manzur Murshed and Rajkumar Buyya
See Also:
Sim_entity, Output, Input
Invariant:
$none

Field Summary
protected  Sim_port input
          Reading data received via input port
protected  Sim_port output
          Sending data via output port to external entities
 
Fields inherited from class eduni.simjava.Sim_entity
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GridSimCore(String name)
          Allocates a new GridSim object without NETWORK communication channels: "input" and "output" Sim_port.
GridSimCore(String name, double baudRate)
          Allocates a new GridSim object with NETWORK communication channels: "input" and "output" Sim_port.
 
Method Summary
protected  void finalize()
          Deprecated. As of GridSim 2.1, replaced by finalizeGridSimulation()
protected  void finalizeGridSimulation()
          It terminates the entities of this object that manage NETWORK communication channels
 boolean isNetworked()
          Check type of entity
 boolean IsNetworked()
          Deprecated. As of GridSim 2.1, replaced by isNetworked()
protected  void send(int entityID, double delay, int gridSimTag)
          Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.
protected  void Send(int entityID, double delay, int gridSimTag)
          Deprecated. As of GridSim 2.1, replaced by send(int, double, int)
protected  void send(int entityID, double delay, int gridSimTag, Object data)
          Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.
protected  void Send(int entityID, double delay, int gridSimTag, Object data)
          Deprecated. As of GridSim 2.1, replaced by send(int, double, int, Object)
protected  void send(Sim_port destPort, double delay, int gridSimTag)
          Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.
protected  void Send(Sim_port destPort, double delay, int gridSimTag)
          Deprecated. As of GridSim 2.1, replaced by send(Sim_port, double, int)
protected  void send(Sim_port destPort, double delay, int gridSimTag, Object data)
          Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.
protected  void Send(Sim_port destPort, double delay, int gridSimTag, Object data)
          Deprecated. As of GridSim 2.1, replaced by send(Sim_port, double, int, Object)
protected  void send(String entityName, double delay, int gridSimTag)
          Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.
protected  void Send(String entityName, double delay, int gridSimTag)
          Deprecated. As of GridSim 2.1, replaced by send(String, double, int)
protected  void send(String entityName, double delay, int gridSimTag, Object data)
          Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.
protected  void Send(String entityName, double delay, int gridSimTag, Object data)
          Deprecated. As of GridSim 2.1, replaced by send(String, double, int, Object)
protected  void TerminateInputOutputEntities()
          Deprecated. As of GridSim 2.1, replaced by terminateIOEntities()
protected  void terminateIOEntities()
          It terminates Entities managing NETWORK communication channels.
 
Methods inherited from class eduni.simjava.Sim_entity
add_generator, add_param, add_port, body, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

input

protected Sim_port input
Reading data received via input port


output

protected Sim_port output
Sending data via output port to external entities

Constructor Detail

GridSimCore

public GridSimCore(String name)
            throws Exception
Allocates a new GridSim object without NETWORK communication channels: "input" and "output" Sim_port. In summary, this object has NO network communication or bandwidth speed.

Parameters:
name - the name to be associated with this entity (as required by Sim_entity class from simjava package)
Throws:
Exception - This happens when creating this entity before initializing GridSim package or this entity name is null or empty
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String), Sim_entity
Pre Condition:
name != null
Post Condition:
$none

GridSimCore

public GridSimCore(String name,
                   double baudRate)
            throws Exception
Allocates a new GridSim object with NETWORK communication channels: "input" and "output" Sim_port. In addition, this method will create Input and Output object.

Parameters:
name - the name to be associated with this entity (as required by Sim_entity class from simjava package)
baudRate - network communication or bandwidth speed
Throws:
Exception - This happens when creating this entity before initializing GridSim package or this entity name is null or empty
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String), Sim_entity, Input, Output
Pre Condition:
name != null, baudRate > 0.0
Post Condition:
$none
Method Detail

TerminateInputOutputEntities

protected void TerminateInputOutputEntities()
Deprecated. As of GridSim 2.1, replaced by terminateIOEntities()

It terminates Entities managing NETWORK communication channels. It can be invoked explicity to shutdown NETWORK communication channels. It is advisable for all entities extending GridSim class, explicitly invoke this method to terminate Input and Output entities created by the constructor: GridSim.GridSim(String, double)

Pre Condition:
$none
Post Condition:
$none

terminateIOEntities

protected void terminateIOEntities()
It terminates Entities managing NETWORK communication channels. It can be invoked explicity to shutdown NETWORK communication channels. It is advisable for all entities extending GridSim class, explicitly invoke this method to terminate Input and Output entities created by the constructor: GridSim.GridSim(String, double)

Pre Condition:
$none
Post Condition:
$none

finalize

protected void finalize()
Deprecated. As of GridSim 2.1, replaced by finalizeGridSimulation()

It terminates the entities of this object that manage NETWORK communication channels

See Also:
terminateIOEntities()
Pre Condition:
$none
Post Condition:
$none

finalizeGridSimulation

protected void finalizeGridSimulation()
It terminates the entities of this object that manage NETWORK communication channels

See Also:
terminateIOEntities()
Pre Condition:
$none
Post Condition:
$none

IsNetworked

public boolean IsNetworked()
Deprecated. As of GridSim 2.1, replaced by isNetworked()

Check type of entity

Returns:
true if entity has NETWORK communication channel, otherwise it returns false
Pre Condition:
$none
Post Condition:
$result == true || false

isNetworked

public boolean isNetworked()
Check type of entity

Returns:
true if entity has NETWORK communication channel, otherwise it returns false
Pre Condition:
$none
Post Condition:
$result == true || false

Send

protected void Send(String entityName,
                    double delay,
                    int gridSimTag)
Deprecated. As of GridSim 2.1, replaced by send(String, double, int)

Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
entityName - the name of the destination entity
delay - how long the event/message should be delivered from the current simulation time. If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
Pre Condition:
entityName != null, delay >= 0.0
Post Condition:
$none

send

protected void send(String entityName,
                    double delay,
                    int gridSimTag)
Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
entityName - the name of the destination entity
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
Pre Condition:
entityName != null, delay >= 0.0
Post Condition:
$none

Send

protected void Send(String entityName,
                    double delay,
                    int gridSimTag,
                    Object data)
Deprecated. As of GridSim 2.1, replaced by send(String, double, int, Object)

Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
entityName - the name of the destination entity
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
data - A reference to data to be sent with the event
Pre Condition:
entityName != null, delay >= 0.0, data != null
Post Condition:
$none

send

protected void send(String entityName,
                    double delay,
                    int gridSimTag,
                    Object data)
Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
entityName - the name of the destination entity
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
data - A reference to data to be sent with the event
Pre Condition:
entityName != null, delay >= 0.0, data != null
Post Condition:
$none

Send

protected void Send(int entityID,
                    double delay,
                    int gridSimTag)
Deprecated. As of GridSim 2.1, replaced by send(int, double, int)

Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
entityID - the id number of the destination entity
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
Pre Condition:
entityID > 0, delay >= 0.0
Post Condition:
$none

send

protected void send(int entityID,
                    double delay,
                    int gridSimTag)
Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
entityID - the id number of the destination entity
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
Pre Condition:
entityID > 0, delay >= 0.0
Post Condition:
$none

Send

protected void Send(int entityID,
                    double delay,
                    int gridSimTag,
                    Object data)
Deprecated. As of GridSim 2.1, replaced by send(int, double, int, Object)

Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
entityID - the id number of the destination entity
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
data - A reference to data to be sent with the event
Pre Condition:
entityID > 0, delay >= 0.0, data != null
Post Condition:
$none

send

protected void send(int entityID,
                    double delay,
                    int gridSimTag,
                    Object data)
Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
entityID - the id number of the destination entity
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
data - A reference to data to be sent with the event
Pre Condition:
entityID > 0, delay >= 0.0, data != null
Post Condition:
$none

Send

protected void Send(Sim_port destPort,
                    double delay,
                    int gridSimTag)
Deprecated. As of GridSim 2.1, replaced by send(Sim_port, double, int)

Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
destPort - A reference to the port to send the event out of
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
Pre Condition:
destPort != null, delay >= 0.0
Post Condition:
$none

send

protected void send(Sim_port destPort,
                    double delay,
                    int gridSimTag)
Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
destPort - A reference to the port to send the event out of
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
Pre Condition:
destPort != null, delay >= 0.0
Post Condition:
$none

Send

protected void Send(Sim_port destPort,
                    double delay,
                    int gridSimTag,
                    Object data)
Deprecated. As of GridSim 2.1, replaced by send(Sim_port, double, int, Object)

Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
destPort - A reference to the port to send the event out of
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
data - an object of type IO_data
See Also:
IO_data
Pre Condition:
destPort != null, delay >= 0.0, data != null
Post Condition:
$none

send

protected void send(Sim_port destPort,
                    double delay,
                    int gridSimTag,
                    Object data)
Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type.

It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:

... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);


// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;

// delay is the simulation time delay
// tag is the event type (user-defined or choose one from GridSimTags class)
send(port, delay, tag, data);
... // remaining other code

Parameters:
destPort - A reference to the port to send the event out of
delay - how long the event/message should be delivered from the current simulation time If delay is a negative number, then it will be changed to 0.0
gridSimTag - an user-defined number representing the type of an event/message
data - an object of type IO_data
See Also:
IO_data
Pre Condition:
destPort != null, delay >= 0.0, data != null
Post Condition:
$none

GridSim
v3.0

The University of Melbourne, Australia, 2004