Flow Control - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Flow Control

Description:

When TCP sends ACK to last FIN, TCP enters TIME_WAIT state ... Only valid segment that can arrive while in TIME_WAIT state is FIN retransmission ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 17
Provided by: LeonG94
Category:
Tags: control | fin | flow

less

Transcript and Presenter's Notes

Title: Flow Control


1
Flow Control
  • Receiver has limited buffering to store arriving
    frames
  • Several situations cause buffer overflow
  • Mismatch between sending rate rate at which
    user can retrieve data
  • Surges in frame arrivals
  • Flow control prevents buffer overflow by
    regulating rate at which source is allowed to
    send information

2
X ON / X OFF
Threshold must activate OFF signal while 2 Tprop
R bits still remain in buffer
3
Window Flow Control
  • Sliding Window ARQ method with Wa equal to buffer
    available
  • Transmitter can never send more than Wa frames
  • ACKs that slide window forward can be viewed as
    permits to transmit more
  • Can also pace ACKs as shown above
  • Return permits (ACKs) at end of cycle regulates
    transmission rate
  • Problems using sliding window for both error
    flow control
  • Choice of window size
  • Interplay between transmission rate
    retransmissions

4
TCP Reliable Stream Service
TCP transfers byte stream in order, without
errors or duplications
Application Layer writes bytes into send buffer
through socket
Application Layer reads bytes from receive buffer
through socket
Write 45 bytes Write 15 bytes Write 20 bytes
Read 40 bytes Read 40 bytes
Application layer
Transport layer
Segments
Transmitter
Receiver
Receive buffer
Send buffer
ACKs
5
TCP ARQ Method
  • TCP uses Selective Repeat ARQ
  • Transfers byte stream without preserving
    boundaries
  • Operates over best effort service of IP
  • Packets can arrive with errors or be lost
  • Packets can arrive out-of-order
  • Packets can arrive after very long delays
  • Duplicate segments must be detected discarded
  • Must protect against segments from previous
    connections
  • Sequence Numbers
  • Seq. is number of first byte in segment payload
  • Very long Seq. s (32 bits) to deal with long
    delays
  • Initial sequence numbers negotiated during
    connection setup (to deal with very old
    duplicates)
  • Accept segments within a receive window

6
Transmitter
Receiver
Send Window
Receive Window
Slast Wa-1
Rlast WR 1
Rlast
...
...
...
Rnext
Rnew
octets transmitted ACKed
Slast
Slast Ws 1
Srecent
Rlast lowest-numbered byte not yet read by the
application Rnext next expected byte Rnew highest
numbered byte received correctly RlastWR-1
highest-numbered byte that can be accommodated in
receive buffer
Slast oldest unacknowledged byte Srecent
highest-numbered transmitted byte SlastWa-1
highest-numbered byte that can be
transmitted SlastWs-1 highest-numbered byte that
can be accepted from the application
7
Flow Control
  • TCP receiver controls rate at which sender
    transmits to prevent buffer overflow
  • TCP receiver advertises a window size specifying
    number of bytes that can be accommodated by
    receiver
  • WA WR (Rnew Rlast)
  • TCP sender obliged to keep outstanding bytes
    below WA
  • (Srecent - Slast) WA

8
TCP window flow control
9
TCP Retransmission Timeout
  • TCP retransmits a segment after timeout period
  • Timeout too short excessive number of
    retransmissions
  • Timeout too long recovery too slow
  • Timeout depends on RTT time from when segment
    is sent to when ACK is received
  • Round trip time (RTT) in Internet is highly
    variable
  • Routes vary and can change in mid-connection
  • Traffic fluctuates
  • TCP uses adaptive estimation of RTT
  • Measure RTT each time ACK received tn
  • tRTT(new) a tRTT(old) (1 a) tn
  • a 7/8 typical

10
RTT Variability
  • Estimate variance s2 of RTT variation
  • Estimate for timeout
  • tout tRTT k sRTT
  • If RTT highly variable, timeout increase
    accordingly
  • If RTT nearly constant, timeout close to RTT
    estimate
  • Approximate estimation of deviation
  • dRTT(new) b dRTT(old) (1-b) tn - tRTT
  • tout tRTT 4 dRTT

11
Silly Window Syndrome
  • Situation
  • Transmitter sends large amount of data
  • Receiver buffer depleted slowly, so buffer fills
  • Every time a few bytes read from buffer, a new
    advertisement to transmitter is generated
  • Sender immediately sends data fills buffer
  • Many small, inefficient segments are transmitted
  • Solution
  • Receiver does not advertize window until window
    is at least ½ of receiver buffer or maximum
    segment size
  • Transmitter refrains from sending small segments

12
Sequence Number Wraparound
  • 232 4.29x109 bytes 34.3x109 bits
  • At 1 Gbps, sequence number wraparound in 34.3
    seconds.
  • Timestamp option Insert 32 bit timestamp in
    header of each segment
  • Timestamp sequence no ? 64-bit seq. no
  • Timestamp clock must
  • Tick forward at least once every 231 bits
  • Not complete cycle in less than one MSL
  • Example clock tick every 1 ms _at_ 8 Tbps wraps
    around in 25 days

13
Delay-BW Product Advertised Window Size
  • Suppose RTT100 ms, R2.4 Gbps
  • bits in pipe 3 Mbytes
  • If single TCP process occupies pipe, then
    required advertised window size is
  • RTT x Bit rate 3 Mbytes
  • Normal maximum window size is 65535 bytes
  • Solution Window Scale Option
  • Window size up to 65535 x 214 1 Gbyte allowed
  • Requested in SYN segment

14
TCP Connection Closing
Graceful Close
15
TIME_WAIT state
  • When TCP sends ACK to last FIN, TCP enters
    TIME_WAIT state
  • Protects future incarnations of connection from
    delayed segments
  • TIME_WAIT 2 x MSL
  • Only valid segment that can arrive while in
    TIME_WAIT state is FIN retransmission
  • If such segment arrives, resent ACK restart
    TIME_WAIT timer
  • When timer expires, close TCP connection delete
    connection record

16
TCP State Transition Diagram
Write a Comment
User Comments (0)
About PowerShow.com