EE450-Discussion8

advertisement
Discussion #8
EE450, 10/13/2010
Sample Problems:
-ARQ protocols (Sliding
window)
Problem#1: Description

Draw a timeline diagram for the sliding window algorithm with
SWS=RWS=4 frames for two given scenarios using the following
assumptions:
1. The receiver sends a duplicate acknowledgement if it does not
receive the expected frame. For example it sends dupack[2]
when it expects to see frame[2] but receives frame[3] instead.
2. The receiver sends a cumulative acknowledgement after it
receives all the outstanding frames. For example it sends
ACK[5] when it receives the lost frame[2] after it already
received frame[3], frame[4] and frame[5].
3. The timeout interval is about 2RTT.
2
Problem#1: Two Scenarios
a. Frame[2] is lost. Retransmission takes place upon
timeout (as usual).
b. Frame[2] is lost. Retransmission takes place either
upon receipt of the first dupack or upon timeout.
Does this scheme reduce the transaction time?
Note that some end-to-end protocols (e.g. variants
of TCP) use a similar scheme for fast retransmission.
3
Problem#1 Solution: Scenario (a)
Receiver
Sender
Ttrans + RTT
Frame[1]
Frame[2]
Frame[3]
Frame[4]
Frame[5]
Ttrans + RTT
Transmission
time
Ack[1]
Dupack[2]
Dupack[2]
Dupack[2]
Timeout=2RTT Frame[2]
Ack[5]
Frame[6]
Ack[6]
time
time
4
Problem#1 Solution: Scenario (b)
Receiver
Sender
Ttrans + RTT
Frame[1]
Frame[2]
Frame[3]
Frame[4]
Frame[5]
Ttrans + RTT
Frame[2]
Transmission
time
Ack[1]
Dupack[2]
Dupack[2]
Dupack[2]
Ack[5]
Frame[6]
Ack[6]
time
time
5
Comparing the two scenarios
Ttrans
Frame[1]
Frame[2]
Frame[3]
Frame[4]
Frame[5]
Timeout=2RTT
Transmission
time
Ack[1]
Frame[1]
Frame[2]
Frame[3]
Frame[4]
Dupack[2]
Frame[5]
2Ttrans
Dupack[2]
Dupack[2]
2Ttrans + 2RTT
Frame[2]
Transmission
time
Ack[1]
Dupack[2]
Dupack[2]
Dupack[2]
Frame[2]
Ack[5]
Ttrans + RTT
Ack[5]
Frame[6]
Frame[6]
Ack[6]
Ack[6]
(a) Delay1= 2Ttrans + 3RTT
(b) Delay2= 4Ttrans + 2RTT
6
Comparing the transaction time
(transfer delay) in the two scenarios
RTT=2Tprop
Delay1= 2Ttrans + 3RTT= 2Ttrans + 6Tprop
Delay2= 4Ttrans + 2RTT=4Ttrans + 4Tprop
?
2Ttrans + 6Tprop > 4Ttrans + 4Tprop
?
2Tprop > 2Ttrans
If Tprop > Ttrans , in Scenario (b) the transaction time is reduced!
7
Problem#2: Description




A is connected to B via an intermediate router R.
The A-R and R-B links each accept and transmit
only one packet per second in each direction (so
two packets take 2 seconds).
The two directions transmit independently.
A sends to B using the sliding window protocol
with SWS=4.
8
Problem#2: Questions?
a)
For Time=0, 1, 2, 3, 4, 5 state what packets arrive at
and leave each node, or label them on a timeline.
1 pkt/sec
A
1 pkt/sec
R
B
b) What happens if the links have a propagation delay of
1 seconds, but accept immediately as many packets as
are offered (i.e. latency= 1 second but bandwidth is infinite).
BW=∞
A
R
Tprop=1 sec
BW=∞
Tprop=1 sec
B
9
Part (a) Solution
SWS=4 packets, RTT=4 sec
T=0 sec
Data[3]
Data[2]
Data[1]
Data[0]
A
Data[3]
Data[2]
0<T<1 sec
Data[1]
Data[0]
A
1<T<2 sec
Data[3]
Data[2]
Data[1]
A
R
B
R
B
R
Data[0]
B
10
Part (a) Solution Ctd.
Ignoring Ack Transmission Time
At T=2 sec Data[0] arrives at B
2<T<3 sec
Data[3]
Data[2]
A
R
Data[1]
Data[0]
B
Ack[0]
At T=3 sec Data[1] arrives at B
3<T<4 sec
A
Data[3]
R
Ack[0]
Data[2]
Data[1]
B
Ack[1]
At T=4 sec Data[2] arrives at B
4<T<5 sec
Ack[0]
A
Data[4]
Ack[1]
R
Data[3]
Ack[2]
At T=5 sec Data[3] arrives at B, and Data[4] arrives at R
Data[2]
B
Part (b) Solution
SWS=4 packets, infinite BW, RTT=4 sec
T=0
Data[3]
Data[2]
Data[1]
Data[0]
A
R
B
Data[3] Data[2] Data[1] Data[0]
T=0+sec
A
R
B
Data[3]Data[2]Data[1]Data[0]
T=1 sec
A
R
B
12
Part (b) Solution Ctd.
Virtually No Transmission Time!
Data[3]Data[2]Data[1]Data[0]
T=1+ sec
A
R
B
A
R
Data[0]
Data[1]
Data[2]
Data[3]
B
A
R
B
T=2 sec
T=2+ sec
Ack[0] Ack[1] Ack[2] Ack[3]
13
Part (b) Solution Ctd.
A
R
B
T=3 sec
Ack[0] Ack[1] Ack[2] Ack[3]
T=3+ sec
A
R
B
Ack[0] Ack[1] Ack[2] Ack[3]
Data[7]
Data[6]
Data[5]
Data[4] A
T=4 sec
Ack[0] Ack[1] Ack[2] Ack[3]
R
B
14
Part (b) Solution Ctd.
Data[7] Data[6] Data[5] Data[4]
T=4+sec
A
R
B
Data[7]Data[6]Data[5]Data[4]
T=5 sec
A
R
B
Data[7]Data[6]Data[5]Data[4]
T=5+sec
A
R
B
15
Problem#3: Description




A is connected to B via an intermediate
router R.
The A-R link is instantaneous but the R-B link
transmit only one packet per second (so two
packets take 2 seconds).
The two directions transmit independently.
A sends to B using the sliding window
protocol with SWS=4.
16
Problem#3 : Questions?
Buffer
BW=Infinity
A
R
1 pkt/sec
B
Tprop=0 sec
a)
For Time=0, 1, 2, 3, 4, 5 state what packets arrive
at and are sent from each node.
b)
How large does the queue at R grow?
17
Part (a) Solution
SWS=4 packets, RTT=2 sec
T=0 sec
Data[3]
Data[2]
Data[1]
Data[0]
A
T=0+sec
A
0<T<1 sec
A
Data[3]
Data[2]
Data[1]
Data[0]
Data[3]
Data[2]
Data[1]
R
B
R
B
R
Data[0]
B
18
Part (a) Solution Ctd.
Ignoring Ack Transmission Time
At T=1 sec Data[0] arrives at B
1<T<2 sec
A
Data[3]
Data[2]
R
Data[1]
Data[0]
B
Ack[0]
T=2 sec
A
Data[3]
R
Data[2]
Ack[0]
Data[1]
B
Ack[1]
Part (a) Solution Ctd.
T=2+sec
A
Data[4]
Data[3]
R
Ack[0]
Data[1]
Data[2]
B
Ack[1]
At T=3 sec Data[2] arrives at B, and Ack[1] arrives at R
3<T<4 sec
A
Data[4]
Ack[1]
R
Data[3]
Data[2]
Ack[2]
B
Part (a) Solution Ctd.
T=3+sec
A
Data[5]
Data[4]
R
Ack[1]
Data[3]
Data[2]
B
Ack[2]
At T=4 sec Data[3] arrives at B, and Ack[2] arrives at R
4<T<5 sec
A
Data[5]
R
Ack[2]
Data[4]
Data[3]
B
Ack[3]
Part (a) Solution Ctd.
T=4+sec
A
Data[6]
Data[5]
Ack[2]
R
Data[4]
Data[3]
B
Ack[3]
At T=5 sec Data[4] arrives at B, and Ack[3] arrives at R
Part (b) Solution
The steady-state queue size at R is two Data Frames.
22
Problem#4: Description



Consider the same topology and situation
as in problem #2.
Assume that the router has a buffer size of
1, i.e. it can hold one packet (or frame) in
to addition to the one it is sending (in each
direction).
Assume that A has a timeout interval of 4
sec and SWS=4.
23
Problem#4 : Questions?
Buffer size=1
BW=∞
A
R
1 pkt/sec
B
Tprop=0 sec
From Time=0, show what happens at each second until
all four packets successfully arrive at B.
24
Solution
SWS=4 packets, RTT=2 sec
T=0 sec
Data[3]
Data[2]
Data[1]
Data[0]
A
R
Data[3]
Data[2]
Data[1]
T=0+sec
A
0<T<1 sec
A
B
R
Data[1]
Dropped
Data[0]
R
B
Data[0]
B
25
Solution Ctd.
Ignoring Ack Transmission Time
1<T<2 sec
A
R
Data[0]
Data[1]
B
Ack[0]
Data[1]
T=2 sec
A
R
Ack[0]
T=2+sec
A
Data[4]
Ack[0]
R
B
Ack[1]
B
Ack[1]
Solution Ctd.
Ignoring Ack Transmission Time
Data[4]
T=3 sec
A
R
B
Ack[1]
T=3+sec
A
Data[5]
R
B
Data[4]
Buffered at B.
Ack[1]
B receives an out of order frame, it does not send an Ack.
At T=4 Timeout for Data[2] and Data[3]. A starts retransmitting them.
At T=4 sec Data[5] also arrives at B.
T=4
Data[3]
Data[2]
A
R
B
Data[4]
Data[5]
Buffered at B.
Solution Ctd.
Ignoring Ack Transmission Time
Data[2]
T=4+sec
Data[3]
A
R
B
Data[4]
Data[5]
Buffered at B.
At T=4+sec, R has started transmitting Data[2] while Data[3] is enqueued.
4<T<5 sec
A
Data[3]
R
Data[2]
B
Data[4]
Data[5]
Buffered at B.
28
Solution Ctd.
Data[3]
T=5+sec
5<T<6 sec
A
A
Data[2] Data[4]
Data[5]
B
Buffered at B.
R
R
Data[3]
Data[2]
B
Ack[2]
Data[4]
Data[5]
Buffered at B.
B received Data[2] which was in-order, so it sends an Ack[2].
T=6 sec
A
R
Ack[2]
Data[3] Data[4]
Data[5]
B
Buffered at B.
B receives Data[3] and can send a Cumulative Ack for Data[3],Data[4] and Data[5]
29
Solution Ctd.
T=6+sec
Data[6]
A
R
Ack[2]
6<T<7 sec
A
B
Cumulative
R
Data[6]
Cumulative
T=7+sec
A
Cumulative
Data[9]
Data[8]
Ack[5]
R
Ack[5]
B
Ack[5]
Data[7]
Data[6]
B
Ack[6]
Problem#5: Description
Suppose we run:
 A sliding Window Protocol (or algorithm)
 With SWS=5, RWS=3
 And no out of order arrivals
31
Problem#5 : Questions?
a) What is the smallest value for MaxSeqNum?
Hint: Assume that it suffices to find the smallest
MaxSeqNum such that if Data[MaxSeqNum] is in the
receive window, Data[0] can no longer arrive.
b) Give an example showing that MaxSeqNum-1 is
not sufficient.
c) State a general rule for the minimum
MaxSeqNum in terms of SWS and RWS.
32
Part (a) Solution
 The smallest working value for
MaxSeqNum is SWS+RWS= 5 +3 =8.
 The earliest possible receive window is Data[6],
Data[7], Data[8].
 Data[5] was delivered and Acknowledged.
 Since SWS=5, all Data[0]s were sent before
Data[5] and by the “no out of order” hypothesis,
Data[0] can no longer arrive.
33
Part (b) Solution
MaxSeqNum-1=7 is not enough because:
 When the receiver is expecting Data[7], an old Data[0]
can still arrive.
 0 and 7 are indistinguishable in mod (MaxSeqNum-1) so
receiver can not tell which one has arrived.
 Consider this example:
 Sender sends Data[0] through Data[4] and they all arrive
so receiver sends Ack[4] but it’s slow.
 The receive window is now Data[5],Data[6] and Data[7].
 Sender times out and retransmits Data[0].
 Receiver accepts it as Data[7].

34
Part (c) Solution
 A general rule for minimum MaxSeqNum
in terms of SWS and RWS:
MaxSeqNum >= SWS+ RWS
35
Problem#6: Description
Suppose we run:

A sliding Window Protocol (or algorithm)

With SWS=RWS=3

And no out of order arrivals

And infinite-precision sequence numbers
36
Problem#6 : Questions?
a) If Data[6] is in the receive window, Data[0] (or
in general any older data) can no longer arrive
(hence that MaxSeqNum = 6 would have
sufficed).
b) Show that if Ack[6] may be sent ( or more
literally, that DATA[5] is in the sending window)
then ACK[2] (or earlier) cannot be received.
37
Problem #6: Hints




Reminder: Let ACK[N] denote the acknowledgment of all data
packets less than N.
Note that data below the sending window (that is, <LAR) is
never sent again.
Hence – because out-of-order arrival is disallowed – if
DATA[N] arrives at the receiver then nothing at or before
DATA[N-3] can arrive later.
Similarly for ACKs, if ACK[N] arrives then (because ACKs are
cumulative) no ACK before ACK[N] can arrive later.
38
Part (a) Solution

If DATA[6] is in the receive window, then
the earliest that window can be is
DATA[4]-DATA[6].

This implies ACK[4] was sent, thus
DATA[1]-DATA[3] were received, and thus
DATA[0] can no longer arrive.
39
Part (b) Solution

If ACK[6] may be sent, then the lowest the
sending window can be is
DATA[3]...DATA[5].

This means that ACK[3] must have been
received.

Once an ACK is received, no smaller ACK can
ever be received later.
40
Problem#7
Design a sliding window ARQ protocol for:
A 1Mbps point-to-point link to the moon
With a one-way latency of 1.25sec
And a frame size of 1KB
Minimum number of bits needed for the sequence number?
Solution:
RTT=2 × 1.25sec=2.5 sec BW=1Mbps=125 KBps
Window size=BW × RTT=125KB/sec × 2.5 sec=312 KB or 312
frames
Sequence number space= 2 × window size= 2 × 312=624
bits required for sequence number space= log2 624=9.285 ~10 bits
41
Download