GridSim 5.0 beta

gridsim.net
Class Link

Object
  extended by Thread
      extended by Sim_entity
          extended by Link
All Implemented Interfaces:
Cloneable, Runnable
Direct Known Subclasses:
FlowLink, SimpleLink

public abstract class Link
extends Sim_entity

This class provides a template for a Link which can connect two entities like routers, GridResources or any other new component that needs to use the network facilities in Gridsim.

In the network model used here, the links only introduce propogation delays. Routers are resposible for queueing and transmission delays. Also, links do not check whether the packets being sent through are of size smaller than the MTU. It is the responsibility of the upstream sender to check the size of the packet. The baud rate and the MTU attributes are stored in the links to facilitate routers and other entities that send data through a link.

Since:
GridSim Toolkit 3.1
Author:
Gokul Poduval & Chen-Khong Tham, National University of Singapore
Invariant:
$none

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  double baudRate_
          Baud rate of this link in bits/s
static int DEFAULT_BAUD_RATE
          Default baud rate of a link in bits/sec
static int DEFAULT_MTU
          Default Maximum Transmission Unit (MTU) of a link in bytes
static int DEFAULT_PROP_DELAY
          Default propagation delay of a link in millisecond
protected  double delay_
          Propagation delay of this link in millisecond
protected  int MILLI_SEC
          A constant represents 1 second in milliseconds
protected  int MTU_
          Maximum Transmission Unit (MTU) of this link in bytes
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Link(String name, double baudRate, double propDelay, int MTU)
          Constructs a Link which simulates a physical link between two entities.
 
Method Summary
abstract  void attach(Sim_entity end1, Sim_entity end2)
          Connects two entities using this link.
abstract  void attach(String end1, String end2)
          Connects two entities using this link.
 double getBaudRate()
          Returns the baud rate of the link in bits/s.
 double getDelay()
          Returns the tramssion delay that this link introduces.
 int getMTU()
          Returns the Maximum Transmission Unit of this Link
 
Methods inherited from class 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, 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

delay_

protected double delay_
Propagation delay of this link in millisecond


baudRate_

protected double baudRate_
Baud rate of this link in bits/s


MTU_

protected int MTU_
Maximum Transmission Unit (MTU) of this link in bytes


DEFAULT_BAUD_RATE

public static final int DEFAULT_BAUD_RATE
Default baud rate of a link in bits/sec

See Also:
Constant Field Values

DEFAULT_PROP_DELAY

public static final int DEFAULT_PROP_DELAY
Default propagation delay of a link in millisecond

See Also:
Constant Field Values

DEFAULT_MTU

public static final int DEFAULT_MTU
Default Maximum Transmission Unit (MTU) of a link in bytes

See Also:
Constant Field Values

MILLI_SEC

protected final int MILLI_SEC
A constant represents 1 second in milliseconds

See Also:
Constant Field Values
Constructor Detail

Link

public Link(String name,
            double baudRate,
            double propDelay,
            int MTU)
     throws ParameterException,
            NullPointerException
Constructs a Link which simulates a physical link between two entities.

Parameters:
name - Name of this Link
baudRate - baud rate of this link (bits/s)
propDelay - Propogation delay of the Link in milli seconds
MTU - Maximum Transmission Unit of the Link in bytes. Packets which are larger than the MTU should be split up into MTU size units.
For e.g. a 1024 byte packet trying to cross a 576 byte MTU link should get split into 2 packets of 576 bytes and 448 bytes.
Throws:
NullPointerException - This happens when name is null or empty
ParameterException - This happens for the following conditions:
  • name is null
  • baudRate <= 0
  • propDelay <= 0
  • MTU <= 0
Pre Condition:
name != null, baudRate > 0, propDelay > 0, MTU > 0
Post Condition:
$none
Method Detail

attach

public abstract void attach(Sim_entity end1,
                            Sim_entity end2)
Connects two entities using this link. Any data sent through one end of this link will be sent out through the other.

Parameters:
end1 - Entity attached to one end of the Link
end2 - Entity attached to the other end of the Link
Pre Condition:
end1 != null, end2 != null
Post Condition:
$none

attach

public abstract void attach(String end1,
                            String end2)
Connects two entities using this link. Any data sent through one end of this link will be sent out through the other.

Parameters:
end1 - Entity attached to one end of the Link
end2 - Entity attached to the other end of the Link
Pre Condition:
end1 != null, end2 != null
Post Condition:
$none

getBaudRate

public double getBaudRate()
Returns the baud rate of the link in bits/s.

Returns:
the baud rate (bits/s)
Pre Condition:
$none
Post Condition:
$none

getDelay

public double getDelay()
Returns the tramssion delay that this link introduces.

Returns:
tranmission delay in milliseconds
Pre Condition:
$none
Post Condition:
$none

getMTU

public int getMTU()
Returns the Maximum Transmission Unit of this Link

Returns:
MTU in bytes
Pre Condition:
$none
Post Condition:
$none

GridSim 5.0 beta

The University of Melbourne, Australia, 2009