DRCL JavaSim API

drcl.intserv
Class Scheduler

java.lang.Object
  |
  +--drcl.DrclObj
        |
        +--drcl.comp.Component
              |
              +--drcl.comp.queue.ActiveQueue
                    |
                    +--drcl.inet.core.Queue
                          |
                          +--drcl.intserv.Scheduler
All Implemented Interfaces:
java.lang.Cloneable, InetConstants, InetCoreConstants, ObjectDuplicable, java.io.Serializable, Wrapper
Direct Known Subclasses:
scheduler_Fifo, scheduler_PGPS, scheduler_SCFQ, scheduler_SFQ, scheduler_SP, scheduler_VC, scheduler_WF2Q

public abstract class Scheduler
extends Queue
implements Wrapper

The information unit a scheduler deals with in our architecture is "flow". A flow is defined as the aggregate traffic of individual traffics originated from a set of sources in the same (multicast) group. Different scheduling algorithms have their own parameters to describe the resource requirement for a flow. The set of parameters is called an "Rspec". Packets are classified to three types: QoS_DATA, CONTROL and BEST_EFFORTS_DATA. By default, QoS_DATA has the highest priority and BEST_EFFORTS has the lowest. That is, when NetworkInterface is ready to transmit a packet, the scheduler looks for available packets from QoS queue(s) first, and the queue of control packets if no QoS packet is available, and then best-efforts packets. However, one can install a special QoS flow for control packets with source and destination set to null address, and/or for best-efforts packets with source set to any address (and destination set to null address) in order to provide hard-guaranteed QoS (lower priority packets may degrade the QoS of QoS flows because packet transmission is not preemptible).
Scheduler Configuration Contract: Component (e.g. PacketFilter Manager) - Scheduler.

See Also:
Serialized Form

Inner classes inherited from class drcl.comp.Component
Component.LockPack
 
Field Summary
static int AVAILABLE_ACTUAL_QoS
           
static int AVAILABLE_ALLOCATED_QoS
           
static int AVAILABLE_BE
           
static java.lang.String BUFFER_CHANGE_EVENT_NAME
          Name of the (reserved) buffer change event.
static java.lang.String BUFFER_CHANGE_EVENT_PORT
          Name of the (reserved) buffer change event port.
protected  double bufferRatio
           
static java.lang.String BW_CHANGE_EVENT_NAME
          Name of the (reserved) bandwidth change event.
static java.lang.String BW_CHANGE_EVENT_PORT
          Name of the (reserved) bandwidth change event port.
protected  double bwRatio
           
protected  int maxBuffer
           
protected  int maxBW
           
 int mtu
           
protected  int nonqosAlloc
           
 double pktLossRate
           
protected  int qosAlloc
           
protected  int qosBuffer
           
protected  int qosBW
           
protected  int qosResvBuffer
           
protected  int qosResvBW
           
 
Fields inherited from class drcl.comp.queue.ActiveQueue
nrequests, outport, OUTPUT_PORT_ID
 
Fields inherited from class drcl.comp.Component
FLAG_COMPONENT_NOTIFICATION, FLAG_DEBUG_ENABLED, FLAG_DIRECT_OUTPUT_ENABLED, FLAG_ENABLED, FLAG_ERROR_ENABLED, FLAG_EVENT_ENABLED, FLAG_GARBAGE_DISPLAY_ENABLED, FLAG_GARBAGE_ENABLED, FLAG_PORT_NOTIFICATION, FLAG_STARTED, FLAG_STOPPED, FLAG_TRACE_ENABLED, FLAG_UNDEFINED_START, id, infoPort, lockHead, name, parent, PortGroup_DEFAULT_GROUP, PortGroup_EVENT, PortGroup_SERVICE, Root, Trace_DATA, Trace_SEND
 
Fields inherited from interface drcl.inet.core.InetCoreConstants
CONFIG_PORT_ID, PULL_PORT_ID
 
Fields inherited from interface drcl.inet.InetConstants
BYTE_MODE, DEFAULT_BANDWIDTH, DEFAULT_BUFFER_SIZE, DEFAULT_MTU, EVENT_ID_CHANGED_PORT_ID, EVENT_IDENTITY_ADDED, EVENT_IDENTITY_REMOVED, EVENT_IF_NEIGHBOR_DOWN, EVENT_IF_NEIGHBOR_UP, EVENT_IF_PORT_ID, EVENT_MCAST_HOST_PORT_ID, EVENT_PKT_ARRIVAL, EVENT_PKT_ARRIVAL_PORT_ID, EVENT_RT_ENTRY_ADDED, EVENT_RT_ENTRY_MODIFIED, EVENT_RT_ENTRY_REMOVED, EVENT_RT_MCAST_CHANGED_PORT_ID, EVENT_RT_UCAST_CHANGED_PORT_ID, EVENT_VIF_NEIGHBOR_DOWN, EVENT_VIF_NEIGHBOR_UP, EVENT_VIF_PORT_ID, HOST_ENTRY_EXT, ID_CSL, MCAST_QUERY_PORT_ID, PACKET_MODE, PID_DV, PID_DVMRP, PID_HELLO, PID_IGMP, PID_OSPF, PID_RSVP, PID_TCP, PID_UDP, SERVICE_CONFIGSW_PORT_ID, SERVICE_ID_PORT_ID, SERVICE_IF_PORT_ID, SERVICE_MCAST_PORT_ID, SERVICE_RT_PORT_ID, UCAST_QUERY_PORT_ID
 
Constructor Summary
Scheduler()
           
Scheduler(java.lang.String id_)
           
 
Method Summary
 int addFlowspec(long[] tos_, long[] tosmask_, SpecFlow fspec_)
          Adds a flowspec.
 int addFlowspec(long tos_, long tosmask_, SpecFlow fspec_)
          Adds a flowspec.
 int addFlowspec(long tos_, SpecFlow fspec_)
          Adds a flowspec.
 void addShaper(int handle_, long[] tos_, long[] tosmask_, TrafficShaper shaper_)
          Adds a shaper in front of this to complete the reservation.
 boolean allocateBuffer(int amount_, int type_)
           
 void configure(int bw_, double bwRatio_, int buffer_, double bufferRatio_)
          Configures the resources (bandwidth and buffer) governed by this scheduler.
 java.lang.Object dequeue()
          Dequeues and returns the first object in the queue.
 void duplicate(java.lang.Object source_)
          Duplicates the content of source_, including ID, name, child components and connections among them, to this component.
 java.lang.Object enqueue(java.lang.Object o_)
          Enqueues the object at the end of the queue
 void freeBuffer(int amount_, int type_)
          Frees buffer from a departing packet.
 Admission getAdmission()
           
 SpecFlow[] getAllFlowspecs()
          Returns the all reservations installed in this link.
 SpecR[] getAllRspecs()
          Returns all the Rspecs installed.
 int getAvailableBuffer()
          Returns the remaining buffer for packet allocation.
 int getAvailableBW()
          Acquires available bandwidth.
 int getAvailableCapacity()
          Returns the buffer size available for reservation.
 int getAvailableQoSBuffer()
          Returns the remaining buffer for QoS flow reservation.
 double getBufferRatio()
          Returns the buffer ratio (%QoS portion).
 int getBW()
          Returns the bandwidth of the interface.
 double getBWRatio()
           
 int getCapacity()
          Returns the capacity of the queue.
 int getCurrentLoad()
           
 double getCurrentLoadByPercentage()
           
 SpecFlow getFlowspec(int handle_)
          Returns the reservation specified by the handle.
 SpecFlow getFlowspec(long tos_)
          Returns the the flow that best matches the ToS value.
 int getMTU()
           
 java.lang.Object getObject()
          Returns the admission object wrapped in this scheduler component.
 double getPktLossRate()
           
 double getPropDelay()
           
 SpecR getRspec(int handle_)
          Returns the flow specified by the handle.
 SpecR getRspec(long tos_)
          Returns the rspec of the flow that best matches the ToS value.
 int getSize()
          Returns the current size of the queue.
 long getToSMask()
           
 java.lang.String info()
          Returns information regarding this component.
 boolean isDegradedQoSEnabled()
           
 boolean isEmpty()
          Return true if the queue is empty.
 boolean isFull()
          Return true if the queue is full.
protected  void process(java.lang.Object data_, Port inPort_)
          The main callback method of a component.
protected abstract  Packet qosDeque()
          Subclasses must override this method to provide its own dequeuing scheme.
protected abstract  void qosEnque(Packet p_, SpecR rspec_)
          Subclasses must override this method to provide its own enqueuing scheme.
 void releaseBW(int amount_)
          Releases bandwidth allocation (from a certain flow).
 void releaseQoSBuffer(int amount_)
          Frees buffer from a QoS flow.
 void removeAllFlowspecs()
           
 SpecFlow removeFlowspec(int handle_)
          Removes a flowspec.
 void removeShaper(int handle_)
          Removes the shaper in a reservation.
 void reset()
          Resets the component for being used anew.
 boolean resvBW(int amount_)
          Allocates bandwidth (for a certain flow).
 java.lang.String resvinfo()
          Displays the reservations installed in this scheduler.
 boolean resvQoSBuffer(int amount_)
          Allocates buffer for a QoS flow.
 void setAdmission(Admission adm_)
           
 void setBufferRatio(double ratio_)
          Sets the buffer ratio (%QoS portion).
 void setBW(int cap_)
          Sets the bandwidth of the interface.
 void setBWRatio(double ratio_)
           
 void setCapacity(int size_)
          Sets the capacity (in bytes) of the queue.
 void setDegradedQoSEnabled(boolean dqos_)
          Enables/disables graceful QoS degradation.
 int setFlowspec(int handle_, long[] tos_, long[] tosmask_, SpecFlow fspec_)
          Adds/modifies the flowspec with the specified handle.
 void setMTU(int mtu_)
           
 void setPktLossRate(double v_)
           
 void setToSMask(long mask_)
          Sets the ToS mask.
 
Methods inherited from class drcl.inet.core.Queue
createConfigPort, getMode, info, isByteMode, isPacketMode, setMode
 
Methods inherited from class drcl.comp.queue.ActiveQueue
_getnrequests, _setnrequests, enqueueAt, firstElement, getAvailableSize, getEnqueCount, increaseEnqueCount, lastElement, peekAt, pull, retrieveAt
 
Methods inherited from class drcl.comp.Component
_resume, _start, _stop, addComponent, addComponent, addEventPort, addEventPort, addForkPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addServerPort, addServerPort, cancelFork, componentAdded, componentRemoved, connect, containsComponent, containsComponent, containsPort, debug, disconnectAll, disconnectAllPeers, disconnectAllPorts, drop, drop, error, error, expose, exposeEventPorts, exposePort, exposePort, exposePort, exposePort, exposePort, findAvailable, findAvailable, findAvailable, finishing, fork, forkAt, getAllComponents, getAllPorts, getAllPorts, getAllWiresInside, getAllWiresInsideOut, getAllWiresOut, getComponent, getComponentFlag, getComponentFlag, getContract, getContractHT, getContractHT, getDebugFlagsInBinary, getDebugLevelNames, getForkManager, getID, getName, getParent, getPort, getPort, getRoot, getRuntime, getTime, iduplicate, isAncestorOf, isComponentNotificationEnabled, isContainer, isDebugEnabled, isDebugEnabledAt, isDirectOutputEnabled, isEnabled, isErrorNoticeEnabled, isEventExportEnabled, isGarbageDisplayEnabled, isGarbageEnabled, isPortNotificationEnabled, isPortRemovable, isStarted, isStopped, isTraceEnabled, lock, notify, notifyAll, operate, portAdded, portRemoved, reboot, removeAll, removeAllComponents, removeAllPorts, removeAllPorts, removeComponent, removeComponent, removePort, removePort, removePort, resume, run, sduplicate, send, sendAt, setComponentFlag, setComponentFlag, setComponentNotificationEnabled, setContract, setDebugEnabled, setDebugEnabled, setDebugEnabledAt, setDebugEnabledAt, setDebugEnabledAt, setDirectOutputEnabled, setDirectOutputEnabled, setEnabled, setErrorNoticeEnabled, setErrorNoticeEnabled, setEventExportEnabled, setEventExportEnabled, setExecutionBoundary, setGarbageDisplayEnabled, setGarbageDisplayEnabled, setGarbageEnabled, setGarbageEnabled, setID, setID, setName, setPort, setPort, setPortNotificationEnabled, setPortRemovable, setRuntime, setTraceEnabled, setTraceEnabled, sleepFor, sleepUntil, stop, toString, unexpose, unlock, useLocalForkManager, useLocalForkManager, wait
 
Methods inherited from class drcl.DrclObj
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BW_CHANGE_EVENT_PORT

public static final java.lang.String BW_CHANGE_EVENT_PORT
Name of the (reserved) bandwidth change event port.

BUFFER_CHANGE_EVENT_PORT

public static final java.lang.String BUFFER_CHANGE_EVENT_PORT
Name of the (reserved) buffer change event port.

BW_CHANGE_EVENT_NAME

public static final java.lang.String BW_CHANGE_EVENT_NAME
Name of the (reserved) bandwidth change event.

BUFFER_CHANGE_EVENT_NAME

public static final java.lang.String BUFFER_CHANGE_EVENT_NAME
Name of the (reserved) buffer change event.

mtu

public int mtu

pktLossRate

public double pktLossRate

maxBW

protected int maxBW

bwRatio

protected double bwRatio

qosBW

protected int qosBW

qosResvBW

protected transient int qosResvBW

maxBuffer

protected int maxBuffer

bufferRatio

protected double bufferRatio

qosBuffer

protected int qosBuffer

qosResvBuffer

protected transient int qosResvBuffer

qosAlloc

protected transient int qosAlloc

nonqosAlloc

protected transient int nonqosAlloc

AVAILABLE_ALLOCATED_QoS

public static final int AVAILABLE_ALLOCATED_QoS

AVAILABLE_ACTUAL_QoS

public static final int AVAILABLE_ACTUAL_QoS

AVAILABLE_BE

public static final int AVAILABLE_BE
Constructor Detail

Scheduler

public Scheduler()

Scheduler

public Scheduler(java.lang.String id_)
Method Detail

reset

public void reset()
Description copied from class: Component
Resets the component for being used anew. All the internal variables must be set to the initial state. All the ports and child components are reset as well.
Overrides:
reset in class Queue

duplicate

public void duplicate(java.lang.Object source_)
Description copied from class: Component
Duplicates the content of source_, including ID, name, child components and connections among them, to this component. Subclasses need to override this method to copy its own variables.
Overrides:
duplicate in class Queue

getObject

public java.lang.Object getObject()
Returns the admission object wrapped in this scheduler component.
Specified by:
getObject in interface Wrapper

enqueue

public java.lang.Object enqueue(java.lang.Object o_)
Description copied from class: ActiveQueue
Enqueues the object at the end of the queue
Overrides:
enqueue in class ActiveQueue
Following copied from class: drcl.comp.queue.ActiveQueue
Returns:
the object being dropped due to the enqueue; null otherwise.

dequeue

public java.lang.Object dequeue()
Description copied from class: ActiveQueue
Dequeues and returns the first object in the queue.
Overrides:
dequeue in class ActiveQueue
Following copied from class: drcl.comp.queue.ActiveQueue
Returns:
the object dequeued; null if position is not valid.

qosEnque

protected abstract void qosEnque(Packet p_,
                                 SpecR rspec_)
Subclasses must override this method to provide its own enqueuing scheme.

qosDeque

protected abstract Packet qosDeque()
Subclasses must override this method to provide its own dequeuing scheme.

process

protected void process(java.lang.Object data_,
                       Port inPort_)
Description copied from class: Component
The main callback method of a component. Being invoked when data arrives at a port of its.
Overrides:
process in class ActiveQueue
Following copied from class: drcl.comp.Component
Parameters:
data_ - the arrival data.
inPort_ - the port where the data arrives.

getAvailableCapacity

public int getAvailableCapacity()
Returns the buffer size available for reservation.

getCapacity

public int getCapacity()
Description copied from class: Queue
Returns the capacity of the queue.
Overrides:
getCapacity in class Queue

setCapacity

public void setCapacity(int size_)
Description copied from class: Queue
Sets the capacity (in bytes) of the queue.
Overrides:
setCapacity in class Queue
Following copied from class: drcl.inet.core.Queue
Parameters:
capacity_ - the new capacity.

setMTU

public void setMTU(int mtu_)

getMTU

public int getMTU()

setPktLossRate

public void setPktLossRate(double v_)

getPktLossRate

public double getPktLossRate()

setAdmission

public void setAdmission(Admission adm_)

getAdmission

public Admission getAdmission()

setToSMask

public void setToSMask(long mask_)
Sets the ToS mask. The ToS of an incoming packet is masked with this mask and then the scheduler obtains the reservation for the masked ToS.

getToSMask

public long getToSMask()

setDegradedQoSEnabled

public void setDegradedQoSEnabled(boolean dqos_)
Enables/disables graceful QoS degradation. If disabled, QoS packets are dropped in absense of an appropriate reservation. Otherwise, the packets are treated with best efforts.

isDegradedQoSEnabled

public boolean isDegradedQoSEnabled()

info

public java.lang.String info()
Description copied from class: Component
Returns information regarding this component. Subclasses should override this method to provide useful information at run-time.
Overrides:
info in class ActiveQueue

resvinfo

public java.lang.String resvinfo()
Displays the reservations installed in this scheduler.

addFlowspec

public final int addFlowspec(long tos_,
                             SpecFlow fspec_)
Adds a flowspec. Subclasses do not need to override this method.
Returns:
a handle for this reservation.

addFlowspec

public final int addFlowspec(long tos_,
                             long tosmask_,
                             SpecFlow fspec_)
Adds a flowspec. Subclasses do not need to override this method.
Returns:
a handle for this reservation.

addFlowspec

public final int addFlowspec(long[] tos_,
                             long[] tosmask_,
                             SpecFlow fspec_)
Adds a flowspec. Subclasses do not need to override this method.
Returns:
a handle for this reservation.

setFlowspec

public int setFlowspec(int handle_,
                       long[] tos_,
                       long[] tosmask_,
                       SpecFlow fspec_)
Adds/modifies the flowspec with the specified handle. If no flowspec exists for the handle, the flowspec is added. Otherwise, the flowspec replaces the original one. No admission control is performed in this method. A subclass may need to override this method to create its own data structure for the successfully installed flow.
Returns:
the handle.

removeFlowspec

public SpecFlow removeFlowspec(int handle_)
Removes a flowspec. A subclass may need to override this method to remove its own data structure for the installed flow.

getFlowspec

public final SpecFlow getFlowspec(int handle_)
Returns the reservation specified by the handle.

getAllFlowspecs

public final SpecFlow[] getAllFlowspecs()
Returns the all reservations installed in this link.

getRspec

public final SpecR getRspec(int handle_)
Returns the flow specified by the handle.

getAllRspecs

public final SpecR[] getAllRspecs()
Returns all the Rspecs installed.

getRspec

public final SpecR getRspec(long tos_)
Returns the rspec of the flow that best matches the ToS value.

getFlowspec

public final SpecFlow getFlowspec(long tos_)
Returns the the flow that best matches the ToS value.

removeAllFlowspecs

public void removeAllFlowspecs()

addShaper

public void addShaper(int handle_,
                      long[] tos_,
                      long[] tosmask_,
                      TrafficShaper shaper_)
Adds a shaper in front of this to complete the reservation. Not all schedulers need to do this.
Parameters:
handle_ - is the one for the reservation.

removeShaper

public void removeShaper(int handle_)
Removes the shaper in a reservation. Not all schedulers need to do this.
Parameters:
handle_ - is the one for the reservation.

resvBW

public final boolean resvBW(int amount_)
Allocates bandwidth (for a certain flow).

releaseBW

public final void releaseBW(int amount_)
Releases bandwidth allocation (from a certain flow).

getAvailableBW

public int getAvailableBW()
Acquires available bandwidth.

getBW

public int getBW()
Returns the bandwidth of the interface.

setBW

public void setBW(int cap_)
Sets the bandwidth of the interface.

getBWRatio

public double getBWRatio()

setBWRatio

public void setBWRatio(double ratio_)

getCurrentLoad

public int getCurrentLoad()

getCurrentLoadByPercentage

public double getCurrentLoadByPercentage()

allocateBuffer

public boolean allocateBuffer(int amount_,
                              int type_)

freeBuffer

public void freeBuffer(int amount_,
                       int type_)
Frees buffer from a departing packet.

resvQoSBuffer

public boolean resvQoSBuffer(int amount_)
Allocates buffer for a QoS flow.

releaseQoSBuffer

public void releaseQoSBuffer(int amount_)
Frees buffer from a QoS flow.

getAvailableQoSBuffer

public int getAvailableQoSBuffer()
Returns the remaining buffer for QoS flow reservation.

getAvailableBuffer

public int getAvailableBuffer()
Returns the remaining buffer for packet allocation.

getBufferRatio

public double getBufferRatio()
Returns the buffer ratio (%QoS portion).

setBufferRatio

public void setBufferRatio(double ratio_)
Sets the buffer ratio (%QoS portion).

getPropDelay

public double getPropDelay()

getSize

public int getSize()
Description copied from class: Queue
Returns the current size of the queue.
Overrides:
getSize in class Queue

isEmpty

public boolean isEmpty()
Description copied from class: ActiveQueue
Return true if the queue is empty.
Overrides:
isEmpty in class ActiveQueue

isFull

public boolean isFull()
Description copied from class: ActiveQueue
Return true if the queue is full.
Overrides:
isFull in class ActiveQueue

configure

public void configure(int bw_,
                      double bwRatio_,
                      int buffer_,
                      double bufferRatio_)
Configures the resources (bandwidth and buffer) governed by this scheduler.
Parameters:
bwRatio_ - the percentage of bandwidth allocated to QoS flows.
bufferRatio_ - the percentage of buffer allocated to QoS flows.

DRCL JavaSim API

Copyright © 2001 - DRCL, OSU     ~ Back to JavaSim Home ~