GridSim
v3.1

gridsim.net
Class SCFQScheduler

Object
  extended bygridsim.net.PacketScheduler
      extended bygridsim.net.SCFQScheduler

public class SCFQScheduler
extends PacketScheduler

SCFQScheduler implements a Self Clocked Fair Queueing Scheduler. A SCFQ is a variation of Weighted Fair Queueing (WFQ), which is easier to implement than WFQ because it does not need to compute round numbers at every iteration. For more details refer to S. R. Golestani's INFOCOM '94 paper A self-clocked fair queueing scheme for broadband applications.

A SCFQ scheduler can provide differentiated service to traffic by changing the weights associated with a certain class of traffic. The higher the weight of a class of traffic, the better treatment it receives. In this class, you can set the weights by calling setWeights() with a linear array of weights. Traffic that is class 0 (default), are assigned the first element of the array as its weight.

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

Constructor Summary
SCFQScheduler()
          Creates a new packet scheduler with the name "SCFQScheduler".
SCFQScheduler(double baudRate)
          Creates a new SCFQ packet scheduler with the specified baud rate (bits/s).
SCFQScheduler(String name)
          Creates a new SCFQ packet scheduler with the specified name.
SCFQScheduler(String name, double baudRate)
          Creates a new SCFQ packet scheduler with the specified name and baud rate (in bits/s).
 
Method Summary
 Packet deque()
          The method deque() has to decide which queue is to be served next.
 boolean enque(Packet pnp)
          Puts a packet into the queue
 boolean isEmpty()
          Determines whether the scheduler is currently keeping any packets in its queue(s).
 boolean setWeights(double[] weights)
          This method allows you to set different weights for different types of traffic.
 int size()
          Determines the number of packets that are currently enqueued in this scheduler.
 
Methods inherited from class gridsim.net.PacketScheduler
getBaudRate, getName, setBaudRate
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SCFQScheduler

public SCFQScheduler(String name,
                     double baudRate)
              throws ParameterException
Creates a new SCFQ packet scheduler with the specified name and baud rate (in bits/s). The name can be useful for debugging purposes, but server no functional purpose.

Parameters:
name - Name of this scheduler
baudRate - baud rate in bits/s of the port that is using this scheduler.
Throws:
ParameterException - This happens when the name is null or the baud rate <= 0
Pre Condition:
name != null, baudRate > 0
Post Condition:
$none

SCFQScheduler

public SCFQScheduler(double baudRate)
              throws ParameterException
Creates a new SCFQ packet scheduler with the specified baud rate (bits/s). The name is set to a generic "SCFQScheduler".

Parameters:
baudRate - baud rate in bits/s of the port that is using this scheduler.
Throws:
ParameterException - This happens when the baud rate <= 0
Pre Condition:
baudRate > 0
Post Condition:
$none

SCFQScheduler

public SCFQScheduler(String name)
              throws ParameterException
Creates a new SCFQ packet scheduler with the specified name. The baud rate is left at 0, and should be set with PacketScheduler.setBaudRate(double) before being the simulation is started.

Parameters:
name - Name of this scheduler
Throws:
ParameterException - This happens when the name is null
See Also:
PacketScheduler.setBaudRate(double)
Pre Condition:
name != null
Post Condition:
$none

SCFQScheduler

public SCFQScheduler()
              throws ParameterException
Creates a new packet scheduler with the name "SCFQScheduler". The baud rate is left at 0, and should be set with PacketScheduler.setBaudRate(double) before being the simulation is started.

Throws:
ParameterException - This happens when the name is null
See Also:
PacketScheduler.setBaudRate(double)
Pre Condition:
$none
Post Condition:
$none
Method Detail

setWeights

public boolean setWeights(double[] weights)
This method allows you to set different weights for different types of traffic. Traffic of class n are assigned a weight of weights[n]. The higher the weight of a class, the better the service it receives.

Parameters:
weights - a linear array of the weights to be assigned to different classes of traffic.
Returns:
true if it is successful, falseotherwise
Pre Condition:
weights != null
Post Condition:
$none

enque

public boolean enque(Packet pnp)
Puts a packet into the queue

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

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 class PacketScheduler
Returns:
the packet to be sent out
Pre Condition:
$none
Post Condition:
$none

isEmpty

public boolean isEmpty()
Determines whether the scheduler is currently keeping any packets in its queue(s).

Specified by:
isEmpty in class PacketScheduler
Returns:
true if no packets are enqueued, false otherwise
Pre Condition:
$none
Post Condition:
$none

size

public int size()
Determines the number of packets that are currently enqueued in this scheduler.

Specified by:
size in class PacketScheduler
Returns:
the number of packets enqueud by this scheduler.
Pre Condition:
$none
Post Condition:
$none

GridSim
v3.1

The University of Melbourne, Australia, 2004