Problem 9 HW 4

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

My Dear Students,

The TA solutions given for problem #9, HW #4 is erroneous. I am re-working part "a" on
FQ. You need to do the same for part "b" of WFQ and e-mail it to me for an extra 1 point
to be added to your midterm score. The deadline is also Sunday, August 10, midnight. I
will also assign full credit to everyone on that problem for your HW score.

7. Consider a router that is managing three flows, on which packets, of fixed length,
arrive at the following times:

Flow A 1 3 4 5 6 7 8
Flow B 1 2 4 6 8 11
Flow C 2 4 7 10

All three flows share the same outgoing link, on which the router can transmit one packet
per unit time. Assume an infinite buffer is available in router

a) Suppose the router implements "Fair Queueing". Find the sequence of Packets output
by the router as a function of time. I am not interested in answers only. Show me the
procedure, i.e. calculate Fi for each packet. If there are "ties", resolve it in order of A,
B, C

b) Now suppose the router is implementing "WFQ". Flows A and B are given equal
share of capacity and flow C is given twice the capacity of flow A. Find the sequence
of Packets output of the router as a function of time. Show all steps of your work

Solutions:

Before we attempt to solve this problem, let me make a point clear. The FQ algorithm is
trying to simulate the ideal bit-by-bit fluid flow mechanism. Fi represent a "Time-Stamp"
indicating the time packet i would have finished being transmitted if it were being sent
using bit-by-bit round robin.

If we have a single flow, the "wall clock" indicating the actual time of arrival of a packet
and the "simulation clock" is the same and hence we use the equation derived in class,
namely:

Fi = Max (Fi-1, Ai) + Pi

Where Ai is the time of arrival of packet "i" and Fi-1 is the finishing time of packet "i-1"
and Pi is the length of packet i.

Now if we have multiple flows, like the problem above, the simulation clock (the round
number) is NOT the same as the wall clock. It has to be slower. Remember that at each

1
time click of the clock all active flows get one bit of service using the ideal bit-by-bit
round robin method. In this case, the clock must advance one tick when "n" bits are
served where n is the number of active flows. It is this clock that is used to calculate the
Fi's. The above equation is still true though. Note that you need to calculate the Fi's for
each packet for every flow (Don't mix the flows). That means that the sequences of Fi's
are calculated "local" to each flow where as the round number is global. Then you treat
all Fi's as time stamps and the router will choose to serve the one that has the smallest Fi
first. Keep in mind the FQ is non-preemptive.

Let us now apply the above discussion to the problem in hand. For part "a" all weights
are the same. The following table presents the results. Assume that all packets of the
same length Pi = 1. The last three columns are the queues for each flow for the
subsequent time interval (including the one that is currently being served). The number of
active queues determines the amount by which the round number is incremented on the
subsequent line. Multiple packets appear at the same time if their Fi's are equal. Ties are
decided in favor of flow A, followed by flow B and flow C.

Wall Round Arrivals Fi Packet A's Queue B's Queue C's


Clock Number Sent Queue
1 1 A1, B1 2, 2 A1 A1 B1
2 1.5* B2, C1 3, 2.5 B1 - B1,B2 C1
3 2 A2 3 C1 A2 B2 C1
4 2.33** A3, B3, C2 4, 4, 3.5 A2 A2, A3 B2, B3 C2
5 2.66 A4 5 B2 A3, A4 B2, B3 C2
6 3 A5 , B4 6, 5 C2 A3, A4, A5 B3, B4 C2
7 3.33 A6 , C3 7, 4.5 A3 A3, A4, A5, A6 B3, B4 C3
8 3.66 A7 , B5 8, 6 B3 A4, A5, A6, A7 B3, B4, B5 C3
9 4 - - C3 A4, A5, A6, A7 B4, B5 C3
10 4.33 C4 5.5 A4 A4, A5, A6, A7 B4, B5 C4
11 4.66 B6 7 B4 A5, A6, A7 B4, B5, B6 C4
12 5 - - C4 A5, A6, A7 B5, B6 C4
13 5.33 - - A5 A5, A6, A7 B5, B6 -
14 5.83 - - B5 A6, A7 B5, B6 -
15 6.33 - - A6 A6, A7 B6 -
16 6.83 - - B6 A7 B6 -
17 7.33 - - A7 A7 - -
18 8.33 - - - - - -

The final sequence is A1, B1, C1, A2, B2, C2, A3, B3, C3, A4, B4, C4, A5, B5, A6, B6, A7

* Here the round number is advanced by 1/2 because there were two sources active when
the clock time was 1 (namely A1 and B1)

** Here the round number is advanced by 1/3 (i.e. 2 + 0.333 = 2.33) because all flows
were active when the clock time was 4 (namely A2, B2 and C1) and so on…..

You might also like