GridSim 5.0 beta

gridsim.net.fnb
Class FIFO

Object
  extended by Thread
      extended by Sim_entity
          extended by FnbSCFQScheduler
              extended by FIFO
All Implemented Interfaces:
PacketScheduler, Cloneable, Runnable

public class FIFO
extends FnbSCFQScheduler

This class implements the FIFO policy for the management of network 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
FIFO(String name, double baudRate, int max_buf_size, double queue_weight, boolean stats)
          Creates a new FIFO policy with the specified name and baud rate (in bits/sec).
 
Method Summary
 double avgQueueSize()
          Calculate the avg queue size for the FIFO algorithm.
 boolean enque(Packet pnp)
          Checks queue size and puts a packet into the queue
 double getAvg()
          Returns the avg buffer size
protected  void initialize()
          This function initializes the parameters of FIFO policy
 boolean setBaudRate(double rate)
          Sets the baud rate that this scheduler will be sending packets at.
 void updateStats()
          Update the statistics of this scheduler to a file.
 
Methods inherited from class FnbSCFQScheduler
body, checkDroppedGlList, deque, 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

FIFO

public FIFO(String name,
            double baudRate,
            int max_buf_size,
            double queue_weight,
            boolean stats)
     throws Exception
Creates a new FIFO policy 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
queue_weight - this parameter reflects how important is the last
stats - 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 FIFO algorithm.

Returns:
the average queue size of this queue, which has been calculated in this function

initialize

protected void initialize()
This function initializes the parameters of FIFO policy

Specified by:
initialize in class FnbSCFQScheduler

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
Pre Condition:
rate > 0
Post Condition:
$none

getAvg

public double getAvg()
Returns the avg buffer size

Specified by:
getAvg in class FnbSCFQScheduler
Returns:
the average queue size, which was already calculated

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".
Note that for the FIFO, MAX_P, MIN_TH, and MAX_TH values are empty.

Specified by:
updateStats in class FnbSCFQScheduler

GridSim 5.0 beta

The University of Melbourne, Australia, 2009