GridSim 5.0 beta

gridsim.net.fnb
Class RED

Object
  extended by Thread
      extended by Sim_entity
          extended by FnbSCFQScheduler
              extended by RED
All Implemented Interfaces:
PacketScheduler, Cloneable, Runnable
Direct Known Subclasses:
ARED

public class RED
extends FnbSCFQScheduler

This class implements the Random Early Detection (RED) policy for the management of netwrk buffers at routers. Its basic functionality is as follows:

For more details, please refer to A. Caminero, A. Sulistio, B. Caminero, C. Carrion, and R. Buyya, Simulation of Buffer Management Policies in Networks for Grids, Proceedings of the 41th Annual Simulation Symposium (ANSS-41, IEEE CS Press, Los Alamitos, CA, USA), April 14-16, 2008, Ottawa, Canada.

Since:
GridSim Toolkit 4.2
Author:
Agustin Caminero

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RED(String name, double baudRate, int max_buf_size, double min_th, double max_th, double max_p, double queue_weight, boolean storeStats)
          Creates a new SCFQ packet scheduler with the specified name and baud rate (in bits/sec).
 
Method Summary
 double avgQueueSize()
          Calculate the avg queue size for the RED algorithm.
 Packet deque()
          The method deque() has to decide which queue is to be served next.
 boolean enque(Packet pnp)
          Checks queue size and puts a packet into the queue
 double getAvg()
          Returns the AVG
 double getMaxP()
          Returns the MAX_P
 double getMaxTh()
          Returns the MAX_TH
 double getMinTh()
          Returns the MIN_TH
protected  void initialize()
          This function initializes the parameters of the buffers policies (RED, ARED)
 boolean setBaudRate(double rate)
          Sets the baud rate that this scheduler will be sending packets at.
 void setMaxP(double m)
          Updates the value of MAX_P
 void setMaxTh(double m)
          Updates the value of MAX_TH
 void setMinTh(double m)
          Updates the value of MIN_TH
 void setQueueWeight(double q)
          Updates the value of QUEUE_WEIGHT
 void updateStats()
          Update the statistics of this scheduler to a file.
 
Methods inherited from class FnbSCFQScheduler
body, checkDroppedGlList, getBaudRate, getCounterDroppedPkts, getMaxBufferSize, getMaxBufferSizeInPkts, getRouterID, getSchedID, getSchedName, increaseDroppedPktCounter, insertGlID_userID, insertPacketIntoQueue, isEmpty, makeRoomForPacket, pktListSize, resetCounterDroppedPkts, setBaudRateSCFQ, setMaxBufferSize, setRouterID, setWeights, size
 
Methods inherited from class Sim_entity
add_generator, add_param, add_port, 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
 

Constructor Detail

RED

public RED(String name,
           double baudRate,
           int max_buf_size,
           double min_th,
           double max_th,
           double max_p,
           double queue_weight,
           boolean storeStats)
    throws Exception
Creates a new SCFQ packet scheduler with the specified name and baud rate (in bits/sec). The name can be useful for debugging purposes, but serves no functional purposes.

Parameters:
name - Name of this scheduler
baudRate - baud rate in bits/s of the port that is using this scheduler.
max_buf_size - maximum buffer size for routers
min_th - minimum threshold for RED
max_th - maximum threshold for RED
max_p - maximum drop probability for RED
queue_weight - queue weight for RED
storeStats - whether we want to store stats or not
Throws:
Exception - This happens when the name is null or the baud rate <= 0
Pre Condition:
name != null, baudRate > 0
Post Condition:
$none
Method Detail

enque

public boolean enque(Packet pnp)
Checks queue size and puts a packet into the queue

Specified by:
enque in interface PacketScheduler
Specified by:
enque in class FnbSCFQScheduler
Parameters:
pnp - A Packet to be enqued by this scheduler.
Returns:
true if enqued, false otherwise
Pre Condition:
pnp != null
Post Condition:
$none

avgQueueSize

public double avgQueueSize()
Calculate the avg queue size for the RED algorithm.

Returns:
the avg queue size, which is calculated in this method

initialize

protected void initialize()
This function initializes the parameters of the buffers policies (RED, ARED)

Specified by:
initialize in class FnbSCFQScheduler

deque

public Packet deque()
The method deque() has to decide which queue is to be served next. In the original WFQ algorithm, this is always the packet with lowest finish time. We also need to update the CF (current finish no.) to that of the packet being served.

Specified by:
deque in interface PacketScheduler
Overrides:
deque in class FnbSCFQScheduler
Returns:
the packet to be sent out
Pre Condition:
$none
Post Condition:
$none

setBaudRate

public boolean setBaudRate(double rate)
Sets the baud rate that this scheduler will be sending packets at.

Parameters:
rate - the baud rate of this scheduler (in bits/s)
Returns:
true if the baud rate has been set properly, false otherwise
Pre Condition:
rate > 0
Post Condition:
$none

updateStats

public void updateStats()
Update the statistics of this scheduler to a file.
The file name is schedulerName_Buffers.csv.
The format is "Clock, MAX_P, MIN_TH, MAX_TH, AVG, QUEUE_SIZE"

Specified by:
updateStats in class FnbSCFQScheduler

getAvg

public double getAvg()
Returns the AVG

Specified by:
getAvg in class FnbSCFQScheduler
Returns:
the avg buffer size

getMaxP

public double getMaxP()
Returns the MAX_P

Returns:
the maximum dropping probability

setMaxP

public void setMaxP(double m)
Updates the value of MAX_P

Parameters:
m - new value for the maximum dropping probability

getMinTh

public double getMinTh()
Returns the MIN_TH

Returns:
the minimum threshold

getMaxTh

public double getMaxTh()
Returns the MAX_TH

Returns:
the maximum threshold

setQueueWeight

public void setQueueWeight(double q)
Updates the value of QUEUE_WEIGHT

Parameters:
q - new queue weight

setMinTh

public void setMinTh(double m)
Updates the value of MIN_TH

Parameters:
m - new minimum threshold

setMaxTh

public void setMaxTh(double m)
Updates the value of MAX_TH

Parameters:
m - new maximum threshold

GridSim 5.0 beta

The University of Melbourne, Australia, 2009