Chap3.5 TCP and Congestion Control

Chap3.5 TCP and - • – $ •" $" $& – 2 • $&"$ $ $ 3 –&$#$ –" • – Many slides in this document adapted

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: • – $ ' • !"# $" # % $ # # &# – 2( • $ +&"$ $! # $ , 3 –&$ ' #$ (' ' – ) ** ( % ( "( , ! # +( • – Many slides in this document adapted from materials for Kurose and Ross, Computer Networking, 5th edition. copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights Reserved #$ ' '+ # •' –' ' $ • • !# socket door application writes data TCP send buffer segment $ - . + / %'- + ! #( + 0 1 $ ' &! $ %'- + ' $ ' #$ # # # -# ( application reads data TCP receive buffer socket door – +( & /+ 6 8 "+ # # $ " $0 "' " 4 $ "( & "( & ' 6 +$ $ 4& ' '' #+ # * 5A41 '" && !$ / + +( >0 $7 9 : 7 : C "' 5" '. -$ # "$ 4 7 9 7 94 #$ *: /+ " -$ # # " $0 ' # $+ ( 67 '- '. "( ' / * *;< = < ' & " $ ' (( $ 0 = '- '. "( / 6? 0 / &# # + -0 #' $ / &# # + -0 * 5A41 –& ( 2 "( & 3 !! & +( 1$ 79 – 54 ! % & % ' $! ( $ – '"( "# 79 B' - $# " !$ +( –7 '$ 1 " ( #( 6 D1 79 ' ! D 1 '& '. D 1 - 79 ' ! '- $ D1 ( (# # ' @ "$ B( • • #+ – &" ( B• $( ( " E $ ( !( " #7 9 "$ ( $( " EstimatedRTT = (1- α)*EstimatedRTT + α*SampleRTT Ì H% Ì Ì " - #E " (" –" ' ( #+# +( # ( " • • ' SampleRTT ( " +( ( ' –+ ( SampleRTT # # ( $ 2( – + # ( "( SampleRTT # +- $ ( + !" ' ! # ( #$' '# # α = A " + % #! # -3 ' F '" " G H% ( # 350 ( * • • ! "$ +– #+ ( ( +3 $( " ( !- " EstimatedRTT -> # + ! ( + EstimtedRTT # 2 ! " ( 300 ( "'- * ( # $ !(H ( $ 250 200 DevRTT = (1-β)*DevRTT + β*|SampleRTT-EstimatedRTT| (typically, β = 0.25) ( " # 150 100 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 TimeoutInterval = EstimatedRTT + 4*DevRTT SampleRTT Estimated RTT # &# $ ' $ ' != 1 " # &# • # $ +( • '"( "# 79 • " +# ( ( • • ' ( ++ $ & –(" – $" #' ! $ (" $ ' $! ( ( +( •' +( - 54 • '" $ ( " • 54 & ( • ( "( & !! $ & 7 9 '$ +( • ! '. # $+ • ( ! #$ "#" 7 9 $ " +/- . ! ( +( !# $ "79$ –"$ . & +( 0 79$ – ( !•% # TimeOutInterval " $+ +( 79 • #' # $ $ ( #! $ 79 # # –+ $" #' –+ !' # '+ ' NextSeqNum = InitialSeqNum SendBase = InitialSeqNum loop (forever) { switch(event) event: data received from application above create TCP segment with sequence number NextSeqNum if (timer currently not running) start timer pass segment to IP NextSeqNum = NextSeqNum + length(data) event: timer timeout retransmit not-yet-acknowledged segment with smallest sequence number start timer event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } } /* end of loop forever */ ( ' : 7 : C $ / ( #! $0 (( I * $C # '"( "# # 7 9 $& H% ( # I * $C JK J -' LK M * $C $ 79$ : 7 : C " # * $& J * $C J * $C J ( # 79' * $C J ( * 5J ( " * 5J X ( ( " ( " ( " ( : 7 : C ' / ( 0 7 9+ Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Arrival of in-order segment with expected seq #. One other segment has ACK pending Arrival of out-of-order segment higher-than-expect seq. # . Gap detected N TCP Receiver action O Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK Immediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq. # of next expected byte Immediate send ACK, provided that segment starts at lower end of gap @ " # * $C J X ( ( "( "# 79' Arrival of segment that partially or completely fills gap ( • ( # " $! ## + $+ – # +$ # & ! # '. : 7 : C •= ! ! $ –! $ ' ($ +( ! # +( % ( &! ( 79 "( 79$ $ # $" #' 79 54% 54% 54% 5 4 %@ 54% X 7 9% 7 9% 7 9% 7 9% • $ '# +( $" #' 7 9 A $ ! $( +( & '. & '. – ! +( # # # #. # & ( $" #' 7 9 !+( – ( ( " G ( # + -( • ' $! ' ' &"! ! / '" #0 " " $ &"! ! ' # !# $ # ' # 1 ! # ' 1 &"! & ! ( + ( "'! event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } else { increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) { resend segment with sequence number y } ' = $ +( $ / &"! 0 ! #' ' • ( ' $ '- + + $ #' 1 Ì $" #' 7 9 ! # $ 7 9 $ +( ! ( '(&# $ + ! ( &"! ! # = $ +( / '" #0 " " $ &"! ! ' ' $ / &"! 0 ! ##' ' . • *# P # $ # *$( –P - ! ' / !' ! - ) ** – *( # +( # $ #= " $0 ## # '- 7 9E $ ' C"! ! /" !$ • " " $ &"! ! " ' +( ' $'$ 0 ' $ " " $ &"! ! '& '# "$ + rwnd # " +( -$ • $ #( 4 ! " 7 9 $& rwnd – +" $ 1 ' ! # 1 &"! ! • •*# " < +# 1 # + -( = rwnd = RcvBuffer-[LastByteRcvd LastByteRead] 7( event:: App produces data if available_data >= MSS && rwnd >= MSS send a full segment else if there is unACKed data in network buffer new data until ACK arrives else send all new data now ( • #' # /A )& 0 H/ / )& 0 /@ ) & 0 )& 0 @ / A 8& 0 Q "( ( $ G .C .C @ .C A)C A)C G ' '# # • $ ' &# - 2' ' 3& ! %'- + + $ +( #, &# – 5A4 – &"! !!' # #! / A RcvWindow0 +A ' ' ) * +( '# +( – '! – $ # – – '! ' +( G& & $-. $ # 54 *;< +( *;< * • ' - *;< 7 9 #' # Socket clientSocket = new Socket("hostname","port number"); &"! ! # 5A4 *;< 7 9 # - '- ( • ' ' $ & '# * Socket connectionSocket = welcomeSocket.accept(); '# -7 9 ' $ ' # '# ) +( '# '# / ' A 0 * # –H ' '# ' '# ' - 7 9A = < ) +( '# '# + / ' A 0 +' ' '# '. clientSocket.close(); '# =' < $ ( # +( ' - 7 9A # $ =A < ' = < ' $ * 2( $ 3 $ -7 9 $= < ' 7 9A $A '# # # * < ' @ ' - '# + * # - ( # ( $ !' # $# ( "# " =A < ($ '# $ ($ '# $ '# $ @ @ ' ) +( / ' 0 •? #! *;< # $ + ' '. !(( ! $0 = $$ ' ( '"' – 6 " # *;< 5" # - & +" / –" -# ! ' #' $ # #! ' '# '# #! ' '# • P- - $! E '# + • ! + $+ ( "'- $ # • ' • &"! ! • " 0 &"! 0 ! " $ " ' !' + Host A ' λin : original data λout !(#2 ( # "' !! - $# 3 • $! ! ! ( !# ' # > •( ! –# '. / ! &"! !# – # +$ # / " + 5" " • &# ( > ! ( Host B unlimited shared output link buffers • #+$# '+ $ • ( % ( "( '&# - "+- " - " • • " $ ( ' &"! ! !' + !# '. ' " • • • ' 0! # 2 !'3 ( ( ' / + λin= λout ( !' + $ "0 # $/ #0 # '. in (. ' λ > λout λin # R/2 λout !$ # + /- !' Host A λout λout λout R/2 λin : original data λ'in : original data, plus retransmitted data λout R/2 R/2 R/3 R/4 Host B finite shared output link buffers λin R/2 λin λin R/2 a. b. c. 2' 3 !' + ./ Ì" $$ Ì( 0! + ( 2+ $ " 3 # .' ( "# # ' !. " • • • !" $ ( "# (" - ' ( Host A !' + B -$λ in ' λ ' λout " E in ' !' + H o s t A H o s t B ' λ o u t λin : original data λ'in : original data, plus retransmitted data finite shared output link buffers Host B Ì ' 2' ' 3 !' + '. $ $ " $! - 2" '. ( $> ( 7 & $ • • • '$ $' + '' $' + $' + # ' • " $ – ' ' # $' + # ! $& '. # 7C • • "$ 7 ) 7C ' + # &# & 2# ' '3 ! $1 2" $ # $ $3 – $ - "# " $ # &# & $ $ ! $1 -' + $ – $#$ ( ( "( +" $ • • ' +( # 0 . $ ( +# & '+ =H< – % #' $ )/ "' ( '# # % #' ! $& '. ! ( . '+ ! $! ( $ (& $# $# '- . & $' + / 7 ?H & *< 7 )0 $ - "# $ • • & $ $ $ '# # & ) '# #& '/ 2 0 – < =& ' /# ($ '+ 0 – =& ' + $' ) '# # "$ $& ' -& ' @ "$ 7 ) 7C ' + ' # Ì '+ $ -"' + H ' ! # # '+ # &# &" - "# $ ( + . &# B- !$ Ì$' • & H / % #' 0! # $ ) '# # '# # &# - –' + $ '- ( # H # " – $1 $ -" ( % ( "( " #, $ '$ ! $& '. H +( ' $ / + $ - +>0 '+ $ ' $+ H "( # $" '+ $' $+ & . $ $ . • H =& – !$ " $ '# # '+ H= $ $ '=& '# # ' $ + ) ' ## $ ) '# # G G '+ Ì2 ' #& $ $( ''" # ' &+ $' # &# .0 + • $ #( " 7 9 $& & #( 2 + "( & #3 ! #$ # ' H & + ! & $ $ -3 ' !7 9 " # "## # ( " $ $' '79$' + +$ $+ + ' $ /' ' # ' & LastByteSent-LastByteAcked ≤ cwnd – cwnd: $ ! ! ! ( rwnd / - E0 – $ #( $ & min(cwnd,rwnd) 79& ' • $' "+-# J ' $ & ' cwnd & 1 $+ • cwnd -3 2 &( $ ( ' !" ' .' + ! ' $ 7 9/ 0 ÌB H$ ! # !# # ' $' E + +( # cwnd •(" ' – '" cwnd #( $"' + !( 79 ' Ì# H $ $ ' # • *# cwnd -' ' &+ )** – % ( # )** J J (' – # J .& # &# & $ $ - ( )** –$ &# 5" '.# ' &# ' % !# '- $ – $ "&# cwnd –$ & '( ! 79 ' cwnd J & R * : 7 : C ' / $ % #! # (0 ' ' !# # +( " • & MM ( " • $" #' 7 9 ( +( + - "+- / ' # ! # (0 – '" cwnd - # # ! ++ #- # + Ì' H + ' # $ # ' • #" # # - -# $ ( " + cwnd & $ ( @ + ssthresh: cwnd - - # ( $ • # ssthresh – ( ( & / # !0 -! • - cwnd MJ ssthresh duplicate ACK dupACKcount++ Λ cwnd = 1 MSS ssthresh = 64 KB dupACKcount = 0 " $& cwnd/2 - '+ !( # !# • # ''" $ '+ '+ + $ ' $ 7=)? ' cwnd > ssthresh cwnd # # – – ' )** cwnd & new ACK cwnd = cwnd+MSS dupACKcount = 0 transmit new segment(s),as allowed cwnd > ssthresh Λ timeout ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment slow start congestion avoidance timeout ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment '&# '+ # # – ( #( cwnd = cwnd + MSS/cwnd ! '79 ' $ @ ' cwnd & )** $$ ' Ì# '" cwnd - # ! / ( "$ '$ # 0 ( "# #' $' Ì79 7=)? 7$$ )"# #' =' ?' @ '+ ' # *) '+ duplicate ACK dupACKcount++ Λ cwnd = 1 MSS ssthresh = 64 KB dupACKcount = 0 ' # *) $ # . new ACK cwnd = cwnd+MSS dupACKcount = 0 transmit new segment(s),as allowed cwnd > ssthresh Λ timeout ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment new ACK cwnd = cwnd + MSS (MSS/cwnd) dupACKcount = 0 transmit new segment(s),as allowed slow start loss: timeout cwnd > ssthresh loss: timeout congestion avoidance slow start congestion avoidance duplicate ACK dupACKcount++ timeout ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment loss: timeout loss: 3dupACK fast recovery new ACK loss: 3dupACK dupACKcount == 3 ssthresh= cwnd/2 cwnd = ssthresh + 3 retransmit missing segment timeout ssthresh = cwnd/2 cwnd = 1 dupACKcount = 0 retransmit missing segment New ACK cwnd = ssthresh dupACKcount = 0 dupACKcount == 3 ssthresh= cwnd/2 cwnd = ssthresh + 3 retransmit missing segment fast recovery duplicate ACK cwnd = cwnd + MSS transmit new segment(s), as allowed @ @@ "# 2!# 3! *"( ( • • ssthresh + $ $ # #A # '+ # - $ $ cwnd < ssthresh + % #A # cwnd >= ssthresh '$+ ssthresh cwnd - "+- " • -1 !' " ! –+ +# + - "+- " ! $ , E $ , # ''" A - "+- " •# P& ––F "! P – + $ P - "+- " P # $$ P A - "+- " A P ©¨¨¤¥¤¢ £¡ ! ¨¨¨© ¨©  ¨¨¦ ¢      ¨©¨§¨¢¥¤¢ ¦ £¡ ' 3 " #$ 2)$ )1 ' 4 $ 0# ) "' %& #( @ • • # $" #' cwnd/2, cwnd ( " ''" ) **A 7 9 ''" ssthresh S ssthresh ssthresh cwnd/2, cwnd @G "" • • • %( # & +( - "+- " 5" $ ,PJ - "+- " ( !# 2# + ! ( !#++( 3 8& • • • @ 1.22 ⋅ MSS RTT L q JT ! ! ! - +$ @ P! & + # !9 $ $'- - "# $ (& + # '. # . ! !9 '( • • !E ! - "+- " - "+- " ' # # + # $' 5" #& 7$$ ' + ( "# #' $' $ $- - ' ' # '+ & ' ' " ' ' # '. $' # '+ $ $' ' $ $ & !' ! $$ ' $ & !' ' $$ ' ! ' @ - "+- " / ( $ 6? • ( "# ( $ " –$ &' + ' 0 $ ## # ' -+ + ! # $ #$ ' • • – ' $" "( "$ '. # 6? $ # !( # #' # ' & A • && $• %( # #. ! " +' ' K – – > .! .! + + ...
View Full Document

This note was uploaded on 03/21/2010 for the course CS 4457 taught by Professor Cetti during the Spring '10 term at UVA.

Ask a homework question - tutors are online