TWiki> CS450 Web>Homework5 (2013-03-22, Main.yjin25)EditAttach

Homework 5

In this homework, we implement reliable communication over a highly unreliable link. The homework template is available at:

svn://cs450.cs.uic.edu/pub/homeworks/hw5

Mininet Setup

We use Mininet to simulate an unreliable link between sender and receiver.

Generally speaking, to set up Mininet, you have two choice: download Mininet VM image and use it directly, or configure it on your own virtual machine. The first choice is easier, you just download the file from https://github.com/mininet/mininet/downloads/, import the file into VMWare and log in with username/password both as "mininet". The second choice is more complicated, due to different version of Ubuntu, you might meet some problems.

You may use either way to do this homework. However, if you spend too much time configuring it, it is better to start early with Mininet VM image file. More specific steps can be found in http://mininet.github.com/download/

After setting up the environment, you need to create a vitual network with two hosts. Run

$ sudo mn --link tc,delay='10ms',loss=5,max_queue_size=2 -x

This will drop you into a mininet shell. To pull up a terminal on each of your new virtual network hosts, run this in the mininet shell:

mininet> xterm h1 h2

Note that you need to have an X Server running and X forwarding enabled for this to work. For windows users, here is a walkthrough for Xming + putty on windows: http://www.math.umn.edu/systems_guide/putty_xwin32.html

For Mac users, you need to install XQuartz. If you want to ssh to this virtual machine, add -X parameter, like "ssh -X <username>@<mininet IP>".

This creates a minimal network topology with two hosts connected to a switch with 10ms latency on each link, 5% packet loss on each link, and a buffer of size 2. Note that there is no space between parameters.

All the operations you perform within these windows are just like if you were using the main linux VM. They work independently like different machines but share the same files on the machine. Usually h1 has IP address 10.0.0.1 and h2 has 10.0.0.2. Try to ping each other. And here are some commands may be useful if you don't use GUI. For more tips, see http://mininet.github.com/walkthrough/.

help % display commands

exit % quit

pingall % all the machine ping each other to test connectivity 

xterm h1 % display h1 termial window

Homework description

At a high level, your job is to change the reliable transport protocol implementation in the template so that the following example execution always produces the correct result. In one terminal(say hw2), you run the receiver in the following way, and it produces output as shown below.

./hw5_receiver <base port> > RECEIVED_FILE
# later on, this happens...
File received, exiting.

In a separate terminal of h1, you run the sender:

cat ORIGINAL_FILE | ./hw5_sender 10.0.0.2 <base port>
Sent 1020544 bytes in 25 seconds: 35 kB/s
Estimated RTT: 1029 ms

The link has a total buffer size of two packets (including packets in both directions). This is specified using the parameter max_queue_size=2. This leaves enough room for a single ack and a single packet in flight at the same time. So you only need to implement a simple TCP with ACK works, no pipelining. If you send a second packet before the first one arrives at the destination, chances are that either an ack or the second packet will be lost, so it is important that you get your timeouts and your acknowledgments right.

A few things to pay attention to:

  • hw5_sender.c, hw5_receiver.c - these are to be thought of as 'applications', using the 'library' you implement in hw5.c. You may change these files, but we will use the original files when grading.
  • hw5.c - this is where your code should go. You will need to make major changes to rel_socket(), rel_connect(), rel_send(), rel_receive() and rel_close().
  • The file transferred: your program should work for any file, and reproduce it exactly. You can check this with the md5sum utility, or diff.
  • The RTT: you are to dynamically estimate the RTT using the EWMA technique, and use this to set your timeout period. With correctly tuned timeouts, lower RTT will result in higher throughput.
  • Keep your packets smaller than or equal to MAX_PACKET (1400 bytes).
Finally:
  • Pay attention to the end of the connection. Ensure that both sides of the connection finish without user assistance, even if packet losses occur, while guaranteeing that the entire file is transferred. Look at the FIN/FINACK/ACK sequence in TCP for ideas.

HINTS

  • For trying out your code, you can tune the packet loss ratios and round-trip latencies by changing the parameters when creating the mininet.
  • In rel_close(), you may want to just wait for some time, to make sure the last ack didn't get lost (leaving one end hanging).

Turn-in instructions

Same story as previous homeworks, except that your makefile should generate two binaries called hw5_ receiver and hw5_sender.

Grading

Grading script usage is following:

./hw5_score username base_port score_file

The grading script will checkout you code from svn, copy a image file supplied in the grading script directory to your directory and run 6 testcases with different latency and forwarding probability. For each test case, there is a minimum throughput requirement and a timeout for your program to exit. The timeout is set as 50% more than the corresponding required throughput. If your program exits normally before the timeout but the content of the received file is invalid then there is 0 point. However, if the program exits normally before the timeout and the received file's content is valid but the throughput obtained is lower than the required minimum throughput then you will get 0.5 point. Finally, if your program doesn't exit before the timeout then it will be killed after timeout and hence the content of the file will be incorrect and you will get 0 point. Sample output from the grading script is following:

[SUCCESS] latency=1000ms packet loss=0% [1]: 1 [throughput (kB/s)=0.26] 
[SUCCESS] latency=100ms packet loss=0% [1]: 1 [throughput (kB/s)=3.11] 
[SUCCESS] latency=10ms packet loss=0% [1]: 1 [throughput (kB/s)=28.78] 
[SUCCESS] latency=100ms packet loss=5% [1]: 1 [throughput (kB/s)=1.36] 
[SUCCESS] latency=10ms packet loss=5% [1]: 1 [throughput (kB/s)=16.22] 
[SUCCESS] latency=10ms packet loss=10% [1]: 1 [throughput (kB/s)=4.86] 
Total score: 6
Topic revision: r9 - 2013-03-22 - 16:53:52 - Main.yjin25
 
Copyright 2016 The Board of Trustees
of the University of Illinois.webmaster@cs.uic.edu
WISEST
Helping Women Faculty Advance
Funded by NSF