next up previous contents
Next: Bibliography Up: A. Appendix Previous: A. Appendix   Contents

Subsections

A..1 Pseudo-code for the Window sizing algorithm

This section aims to clarify the clients paper and more precisely state what we understand from the client's paper and how its intended to be implemented.

A..1.1 Router Module

/* global variables on the Router.*/
int qlength;
int b = 10; 
int qmin = 20; 


int evaluatepq();

/* Where b and qmin control the equilibrium mean queue size.
 * mu is the output rate of the bottleneck.  */
evaluatepq()
{
    int pq;
    
       if ( queuelength < qmin)
           return 0;
       else
       {
           pq = b / mu * (qlength - qmin);
           return pq;
       }
}

A..1.2 Receiver Module

/* global variables */
int alpha = 250; 
int tow = 1; 
int pq;
int oldrrate;
int oldtime;
int oldwindowsize;
#define PS_THRESH -.2

int topcontrol();
int getrrate();
int getwindowsize();

/* returns the next window size. */
topcontrol()
{
    int currenttime;

    rrate = getrrate();
    currenttime = getcurrenttime();
    rtriptime = currenttime-oldtime;
    while(tow-pq*rrate*rtriptime <= PS_THRESH)
    {/* To prime the network we use the prime start phase to calculate 
    window size. Aims not to overflow the unknown links, but to increase 
    the window size rapidly in order to fill the network pipes. */
        if (oldwindowsize == 0)
        windowsize = 2;
        else
        windowsize = 2*oldwindowsize;
    }
    /* after the prime start phase we use getwindowsize to calculate
     * the nest windowsize. */
    windowsize = getwindowsize();
    
    /* Keep the Global variables up to date. */
    oldtime = currenttime;
    oldwindowsize = windowsize;
    oldrrate = rrate;
    
return windowsize;
}
    
/* received rate (rrate) reduces the window size at a rate which increases 
 * with the occupancy of the queue and the traffic due to flow. */
getrrate()
{
    int newrrate;

    rtriptime = getcurrenttime() - oldtime;
    newrrate = alpha*oldrrate + (1-alpha)*(oldwindowsize/rtriptime);
    
return newrrate;
}
 

/* tow is a constant that tries to increase the window at a constant
 * rate.  */
getwindowsize()
{
    int newwindowsize;
    
    rtriptime = getcurrenttime() - oldtime;
    rrate = getrrate(pq,oldrrate,oldtime);
    newwindowsize = oldwindowsize + (tow - pq * rrate)*rtriptime;

return newwindowsize;
}