Presentation is loading. Please wait.

Presentation is loading. Please wait.

3. END-TO-END PROTOCOLS (PART 2) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March

Similar presentations


Presentation on theme: "3. END-TO-END PROTOCOLS (PART 2) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March"— Presentation transcript:

1 3. END-TO-END PROTOCOLS (PART 2) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March 2016 1

2 2 1. Sliding window algorithm in TCP The classical TCP employs a sliding window protocol with +ve acknowledgment and without selective repeat. TCP uses sliding window algorithm to guarantee the reliable delivery of data, ensure the data is delivered in order, enforce flow control between sender and receiver, and perform congestion control (Chapter 6.3 in the text)

3 3 1.1 TCP send and receive buffers Sender buffer size: MaxSendBuffer Receive buffer size: MaxRcvBuffer Sending application LastByteWritten TCP LastByteSentLastByteAcked Receiving application LastByteRead TCP LastByteRcvdNextByteExpected (a)(b)

4 4 1.2 TCP send and receive states Sender: LastByteAcked <= LastByteSent LastByteSent <= LastByteWritten Data, for which LastByteAcked < SN <= LastByteWritten, must be buffered. LastByteWritten - LastByteAcked <= MaxSendBuffer Receiver: LastByteRead < NextByteExpected NextByteExpected <= LastByteRcvd + 1

5 5 1.3 TCP flow control Data, for which LastByteRead < SN <= LastByteRcvd, must be buffered. LastByteRcvd - LastByteRead <= MaxRcvBuffer Flow control (performed by the receiver) AdvertisedWindow = MaxRcvBuffer - (LastByteRcvd - LastByteRead), the amount of free space left in the receiver’s buffer. The receiver sends AdvertisedWindow in the AdvertisedWindow field in the TCP header.

6 6 1.4 Window size for TCP sender MaxWindow is the window size used in the sliding window protocol. MaxWindow is jointly determined by receiver and sender. MaxWindow is dynamically adjusted. MaxWindow = min{ AdvertisedWindow, CongestionWindow } CongestionWindow is determined by the sender. LastByteSent - LastByteAcked <= AdvertisedWindow

7 7 1.5 Acknowledgment strategies An acceptable ACK is one for which LastByteAcked < acknowledgment field  LastByteSent + 1 An acknowledgment field = LastByteAcked is a duplicate ACK. Acknowledge every segment received vs. delayed acknowledgment. Whenever a out-of-ordered segment is received, a TCP receiver responds with an ACK for SN = NextByteExpected (a duplicate ACK).

8 8 2. Retransmission strategies A sender may retransmit the segment with SN = LastByteAcked + 1 Upon retransmission timeout or Upon receiving the third duplicate ACK (Jacobson’s fast retransmission)

9 9 3. Estimating the round trip delay Problem: How does a TCP sender determine its timeout value? If over-estimate the timeout value, delay the retransmission. If under-estimate the timeout value, inject duplicate packets into the network. TCP uses an adaptive transmission algorithm to accommodate varying delays in the Internet: A TCP sender monitors the round trip time (RTT), either in coarse- grain or fine-grain measurement. Exponential backoff

10 10 3.1 RTT measurements and timeout Given a new RTT measurement M, TCP updates an estimate of the average RTT by R =  R + (1   )M.  is a filter gain constant (0 <  < 1), determining how much the new measurement contributes to the estimate.  is usually set to 0.9. The timeout value RTO is set to   R.  accounts for the variation in the RTT.  is usually set to 2.

11 11 3.1 RTT measurements and timeout Solid line: Retransmit timer Dotted line: A packet’s RTT

12 12 3.2 A better estimator Estimate the variation in the RTT by Diff = M  R. R = R + (   Diff) D = D +   (|Diff|  D).  is a fraction between 0 and 1. The timeout value is now given by RTO =   R +   D.  is typically set to 1 and  to 4. How does the initialization of the parameters affect the estimator?

13 13 3.2 A better estimator Solid line: Retransmit timer Dotted line: A packet’s RTT

14 14 3.3 Retransmission ambiguity Problem: When retransmission occurs, how would the sender know whether the received ACK is for the original segment or the retransmitted segment? The answer to the question above affects the timeout estimate. One simple solution is to exclude the RTT measurements for retransmitted segments. Does this solution work?

15 15 3.4 Karn/Partridge algorithm When a timeout or retransmission occurs, Do not update the RTT estimator when the ACK for the retransmitted segment arrives. Moreover, set RTO =  RTO,  > 1 (backoff RTO). Calculate a new RTO when an ACK is received for a segment that was not retransmitted.

16 16 Acknowledgments The two RTT diagrams are taken from Van Jacobson, “Congestion avoidance and control,” Proc. SIGCOMM, vol. 18, no. 4, Aug. 1988.


Download ppt "3. END-TO-END PROTOCOLS (PART 2) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March"

Similar presentations


Ads by Google