Instructions for TCP Exercise

3.5 An Experimental Congestion Avoidance module for Linux

Source code needed (to-be changed by you):

  • Makefile
  • tcp_exp.c
    In this exercise, you will develop and evaluate a TCP congestion control module for the Linux kernel. Linux provides a pluggable interface for TCP congestion control, which allows named congestion control modules to manipulate its sending rate and reaction to congestion events. You have already used the reno and cubic modules, and in this exercise you will create one named exp.
    Linux kernel modules must be compiled against kernel source that matches the kernel into which the module will be loaded. In order to prepare your ProtoGENI host for kernel module development, follow these steps:
  1. Install the required packages with this command:
    sudo yum install kernel-devel kernel-headers
  2. Fix up the kernel version in the installed headers to match the running kernel; this can be tricky, but these steps should handle it.
    1. Find your kernel sources. They are in /usr/src/kernels, in a directory that depends on the installed version. As of the time this handout was created, that directory is We will call this directory $KERNELSRC.
    2. Identify your running kernel version by running uname -r. It will be something like 2.6.40-4.emulab2.fc15.i686.PAE. The first three dotted components (2.6.40, in this case) are the major, minor, and micro versions, respectively, and the remainder of the version string (-4.emulab2.fc15.i686.PAE) is the extraversion. Note the extraversion of your kernel.
    3. In $KERNELSRC/Makefile, find the line beginning with EXTRAVERSION. Replace its value with the extraversion of your kernel. Also update VERSION, PATCHLEVEL, and SUBLEVEL to match your version. (For example, for the above version that means setting PATCHLEVEL = 0.)
    4. Update the kernel header tree to this new version by running the command:
      cd $KERNELSRC
      sudo make include/generated/utsrelease.h


  • A Makefile for compiling the module and the source for a stub TCP congestion control module are included in Makefile
  • The module is named tcp_exp (for experimental TCP), and the congestion control algorithm is named exp. Comments in the provided source file explain the relationship between the various functions, and more information can be found in pluggable congestion avoidance modules.
  • The compiled module (which is built with make and called tcp_exp.ko) can be inserted into the kernel using sudo /sbin/insmod. It can be removed using the command sudo /sbin/rmmod tcp_exp and reloaded with /sbin/insmod if changes are required. (If rmmod doesn't work initially, make sure cat /proc/sys/net/ipv4/tcp_congestion_control does not say exp and then logout and then log back into the node and try again.)
  • Once the module is complete and loaded into the kernel, the algorithm implemented by the module can be selected in the same manner that reno and cubic were selected in previous exercises, by placing the keyword exp in /proc/sys/net/ipv4/tcp_congestion_control.
  • More details to handle version issues are provided at Building modules for a precompiled kernel.
  • dmesg may give you a clue to some errors.

3.5.1 Algorithm Requirements
The experimental congestion control module is based on Reno, but has the following modifications:

  • It uses a Slow Start exponential factor of 3. Reno uses 2.
  • It cuts ssthresh to 3 × FlightSize/4 when entering loss recovery. Reno cuts to FlightSize/2.

3.5.2 Hints
These hints and suggestions may help you get started.

  • When you start, renew your resources through the Portal so that the resources don't disappear while you are working.
  • Edit tcp_exp.c on your local machine and then use scp to load Makefile and modified versions of tcp_exp.c onto your nodes. Use the same values of PORT, USERNAME, and HOSTNAME that you use to ssh onto the nodes.
    scp -P PORT my_file.txt USERNAME@HOSTNAME:.

3.5.3 Evaluation

Once you have implemented the algorithm described above, answer the following questions:

  • 1. Question: Discuss the impact of these algorithmic changes in the context of traditional Reno congestion control.
  • 2. Question: Compare the convergence time and fairness of your algorithm with Reno and Cubic under (a) high delay (500 ms) and (2) high loss (5%) conditions. Use Jain’s fairness index, or some other quantitative measure of fairness, in your comparison.
Last modified 8 years ago Last modified on 12/11/13 17:30:53

Attachments (2)

Download all attachments as: .zip