CS625, Fall 2003, Assignment-2
- Please read the assignment in full before you start out.
- The assignment will be due after Diwali, Mon, 27 Oct 2003 23:59:59
- Assignments have to be done individually and NOT in
- You can take the help of the TAs or me (not your fellow
students) for the following auxiliary tools: UNIX, bash, perl,
gnuplot, gimp, etc. But most of you probably have sufficient
knowledge of these anyway -- at least as much is required for
- Any reference (including google search) is allowed except
consulting your fellow students in any way.
- You will submit this assignment electronically. Please
submit a neatly typed out document (text only please)
answering the questions in the various parts. Please follow the
format below for ease of correction:
- Please email your submission to
- You may consider your submission complete ONLY after you get a
confirmation response. I will stick around in my office around
the mid-night before the submission deadline, so that you can
approach me if there are any problems with the submission at the
Brief Overview and Background
In this assignment you will be examining the performance of
multiple TCP connections over a bottleneck link. You will use ns-2, as in assignment-1. It
has been installed in the cs625 account. To use ns, set your shell
PATH variable to include "/3u3/course/cs625/ns-allinone-2.26/bin".
The NS documentation is available at
"/3u3/course/cs625/doc/ns_doc.pdf". There is a TCL reference book at
"/3u3/course/cs625/doc/part2.pdf", in case you need it.
For your exercises, you will be creating the following simple
dumbbell topology, so called due to its shape.
There are "n" nodes on either side, and two other nodes in the
middle. You will use different values of the parameter "n" in
different simulations. All links have the same capacity: 1Mbps (in
ns-2 this would be 1,000,000 bits-per-second), and the same latency:
10ms. Use DropTail (FIFO) queuing for all the links (like in your
Note: Do not use any restrictions on the queue size, and apart from
everything mentioned here, leave everything to be the default value.
There will be "n" TCP connections. TCP connection i will be
between nodes Ai and Bi. There will be "n" FTP
connections, one on top of each TCP connection. Start the connections
all at time 0.5 seconds, and terminate them all at 10.5 seconds. Also
terminate the simulation itself at 10.5 seconds.
Questions [Total: 10 marks]
- Consider a topology with "n" being 1, and thus just a single TCP
- What is the median packet inter-arrival time at the TCP
receiver? (For this, consider only those pairs of packets
with adjacent sequence numbers received one after another at
the receiver.) (Note that you are asked for the
median value, not the average). [1 mark]
- Explain the above median value in terms of the packet size
and the bottleneck bandwidth. [1 mark]
- For each sequence number N received at the receiver,
calculate the inter-arrival time with respect to the
previous sequence number (as above, consider only those
pairs of packets with adjacent sequence numbers received one
after another at the receiver). Plot a graph of the
inter-arrival time as a function of the sequence number, for
the first 100 sequence numbers. Submit this graph named as
ia-q1.jpg (or any other appropriate UNIX readable format).
(You do not have to write anything in ans.txt for this
part). [1 mark]
- Explain the above graph briefly (4-5 sentences max). [1 mark]
- Now consider a topology with "n" being 2, and thus two TCP
- Calculate the average and the standard
deviation (not variance) of the inter-arrival time, for
each of the two TCP connections. [0.5 marks]
- Compare the average inter-arrival time in the above answer,
with the average inter-arrival time in the "n=1" case (the
previous question). [0.5 marks]
- Now consider a topology with "n" being 3, and thus three TCP
- For each of the TCP connections, calculate the
average and standard deviation of the packet
inter-arrival times. [0.5 mark]
- Plot a single graph, but with three plots within it
-- each plot corresponds to the inter-arrival time versus
sequence number plot for a TCP connection (just as in the
first question). Plot this just for the first 100 sequence
numbers, as earlier. Submit this graph as ia-q3.jpg (or an
appropriate extension -- in a UNIX readable format). (There
is nothing to write in ans.txt for this part of the
question). [1 mark]
- Explain the above average and standard deviation, as well as
the graph above. Explain with respect to what you found in
the "n=1" and "n=2" cases. (6-7 sentences max). [1.5
- Now, make the X-Y link use a WFQ queuing discipline, instead of
a DropTail (FIFO) discipline. (For this you simply have to
replace the word DropTail with WFQ, for the X-Y link -- do this
just for the X-Y link). Repeat the above run with "n=3".
- What is the standard deviation of the inter-arrival
time for each of the three TCP flows? [0.5 marks]
- How does this compare with what you found in the DropTail
case with "n=3" and why? (2-3 sentences max) [0.5
- Submit your code in the name q4.tcl just for this part (no
marks :-) (I probably won't look into this code unless I
find something weird in your submission).
- In both the DropTail case and the WFQ case, for "n=3", compute
the last successfully received sequence number for each of the
three TCP connections (this is indicative of the throughput
received by each of the TCP flows). Compare what you find in
the two cases DropTail and WFQ and give a short reasoning for
what you find. (4-5 sentences max). [1 mark]
Checklist before submission
In ans.txt, you should have answers for:
1(a), 1(b), 1(d)
In the a2-xyzabc directory, you should have (only):
Here are some steps I followed while working out this assignment.
I don't necessarily expect you to follow the same steps, but if you
do, it will hopefully be very easy to go through the assignment.
- Use flow-ids (by setting fid_) for each of the TCP flows, this
will likely make the parsing of your output trace easier.
- Write a program (I wrote it in perl and called it rcv-time.pl)
which takes in the output trace, and a particular flow-id. It
looks for lines which represent TCP packet reception at the
receiver, and prints out a file with two columns -- the time,
and the sequence number received.
- Write a program (I wrote it in perl and called it
inter-arrival.pl) which takes in the output of rcv-time.pl, and
looks for adjacent lines with adjacent sequence numbers. For
each such pair of lines, it outputs another line onto a file.
The output file of inter-arrival.pl can have two columns: the
inter-arrival time, and the corresponding sequence number.
- The program inter-arrival.pl also calculates the average and the
standard deviation of the inter-arrival times.
- With these programs in place, your assignment should proceed
- If you know perl, your life will be easy in doing the above
parsing. You can either invest time learning some basic perl if
you do not already know, or resort to some language like
"C/C++/Java" if you do not know.
- You can use "gnuplot" to plot your graphs. An example gnuplot
script is here. This is just a
sample -- understand it and make your modifications as
appropriate. Gnuplot has an help menu which you can get by
typing "help" from within gnuplot.
- You can learn TCL arrays to make your ns code easier -- look at
the corresponding chapter in the TCL reference given above. Of
course, you can write your code without using arrays as well.
- Your life will be easier if you make the parameter "n" a
command-line argument to "ns". You can learn about command-line
arguments in TCL, also in the reference given above.
Last modified: Fri Oct 10 22:54:36 IST 2003