1 / 43

Chapter 12 Transmission Control Protocol (TCP)

Chapter 12 Transmission Control Protocol (TCP). Mi-Jung Choi Dept. of Computer Science and Engineering mjchoi@postech.ac.kr. Contents . 12.1 TCP SERVICES 12.2 TCP FEATURES 12.3 SEGMENT 12.4 A TCP CONNECTION 12.5 STATE TRANSITION DIAGRAM 12.6 FLOW CONTROL 12.7 ERROR CONTROL

jaden
Télécharger la présentation

Chapter 12 Transmission Control Protocol (TCP)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 12 Transmission Control Protocol (TCP) Mi-Jung Choi Dept. of Computer Science and Engineering mjchoi@postech.ac.kr

  2. Contents 12.1 TCP SERVICES 12.2 TCP FEATURES 12.3 SEGMENT 12.4 A TCP CONNECTION 12.5 STATE TRANSITION DIAGRAM 12.6 FLOW CONTROL 12.7 ERROR CONTROL 12.8 CONGESTION CONTROL 12.9 TCP TIMERS 12.10 OPTIONS 12.12 TCP PACKAGE

  3. Objectives • Be able to name and understand the services offered by TCP • Understand TCP’s flow and error control and congestion control • Be familiar with the fields in a TCP segment • Understand the phases in a connection-oriented connection • Understand the TCP transition state diagram • Be able to name and understand the timers used in TCP • Be familiar with the TCP options

  4. 12.8 Congestion Control • Congestion in a network may occur if the load on the network is greater than the capacity of the network • Congestion control refers to the mechanism and techniques to control the congestion and keep the load below the capacity • Congestion in a network or internetwork occurs because routers and switches have queues

  5. Congestion Control (cont’d)

  6. Congestion Control (cont’d) • Network performance • Delay versus Load

  7. Congestion Control (cont’d) • Throughput versus Load • the reason is the discarding of packets by the routers

  8. Congestion Control (cont’d) • Congestion control mechanisms • refers to techniques and mechanisms that can either prevent congestion, before it happens, or remove congestion, after it has happened • open-loop congestion control (prevention) and closed loop congestion control (removal)

  9. Congestion Control (cont’d) • Open-loop congestion control • Retransmission policy • The retransmission policy and the retransmission timers must be designed to optimize efficiency and at the same time prevent congestion • Acknowledgment policy • If the receiver does not acknowledge every packet it receives, it may slow down the sender and help prevent congestion • Discard policy • In audio transmission, if the policy is to discard less sensitive packets when congestion is likely, the quality of sound is still preserved and congestion is prevented

  10. Congestion Control (cont’d) • Closed-loop congestion control • Back pressure • informing the previous upstream router to reduce the rate of outgoing packets • Choke point • is a packet sent by a router to the source to inform it of congestion • is similar to ICMP’s source quench packet • Implicit signaling • Detecting an implicit signal warning of congestion and slow down its sending rate. Ex) receiving delayed ACK • Explicit signaling • Router experiencing congestion can send an explicit signal by setting a bit in a packet to the sender or the receiver

  11. Congestion Control in TCP • Congestion window • Today, TCP protocols include that the sender’s window size is not only determined by the receiver but also by congestion in the network • Actual window size = minimum (rwnd, cwnd)

  12. Congestion Control in TCP (cont’d) • Slow start: exponential increase MSS (max. segment size)

  13. Congestion Control in TCP (cont’d) • In the slow start algorithm, the size of the congestion window increases exponentially until it reaches a threshold Start  cwnd = 1 After 1 RTT  cwnd = 1 x 2 = 2  21 After 2 RTT  cwnd = 2 x 2 = 4  22 After 3 RTT  cwnd = 4 x 2 = 8  23

  14. Congestion Control in TCP (cont’d) • Congestion avoidance: additive increase • When the size of the congestion window reaches the slow start threshold, in the congestion avoidance algorithm, the size of the congestion window increases additively until congestion is detected

  15. Congestion Control in TCP (cont’d) • Congestion detection: Multiplicative Decrease • Most implementations react differently to congestion detection: • If detection is by time-out, a new slow start phase starts • If detection is by three ACKs, a new congestion avoidance phase starts

  16. Congestion Control in TCP (cont’d) • TCP congestion policy summary

  17. Congestion Control in TCP (cont’d) • Congestion example

  18. 12.9 TCP Timers • To perform its operation smoothly, most TCP implementations use at least four timers

  19. TCP Timers • Round Trip Time (RTT) • To calculate the retransmission (RTO), we first need to calculate the round-trip time (RTT) • In TCP, there can be only one RTT measurement in progress at any time • Measured RTT (RTTM) : how long it takes to send a segment and receive an acknowledgment of it

  20. TCP Timers • Smoothed RTT (RTTS) : Weighed average of RTTM and previous RTTS Original  No Value After first measurement  RTTS = RTTM After any other measurement  RTTS = (1- ) RTTS + · RTTM The value of  is implementation-dependent, but it is normally set to 1/8

  21. TCP Timers • RTT Deviation (RTTD) • Original  No Value • After first measurement  RTTD = RTTM/2 • After any other measurement  RTTD = (1- ) RTTD + · l RTTS – RTTM I The value of  is also implementation dependent, but is it is usually is sent to ¼.

  22. TCP Timers • Retransmission Timeout (RTO) Original  Initial Value After any measurement  RTO = RTTS + 4 RTTD

  23. Example 10 Let us give a hypothetical example. Figure 12.38 shows part of a connection. The figure shows the connection establishment and part of the data transfer phases. 1. When the SYN segment is sent, there is no value for RTTM , RTTS , or RTTD . The value of RTO is set to 6.00 seconds. The following shows the value of these variables at this moment: RTO = 6 2. When the SYN+ACK segment arrives, RTTM is measured and is equal to 1.5 seconds. The next slide shows the values of these variables: RTTM = 1.5 RTTS = 1.5 RTTD = 1.5 / 2 = 0.75 RTO = 1.5 + 4 * 0.75 = 4.5

  24. Example 10 (cont.) 3. When the first data segment is sent, a new RTT measurement starts. Note that the sender does not start an RTT measurement when it sends the ACK segment, because it does not consume a sequence number and there is no time-out. No RTT measurement starts for the second data segment because a measurement is already in progress. RTTM = 2.5 RTTS = 7/8 (1.5) + 1/8 (2.5) = 1.625RTTD = 3/4 (0.75) + 1/4 |1.625 − 2.5| = 0.78 RTO = 1.625 + 4 (0.78) = 4.74

  25. Example 10 (cont.)

  26. TCP Timers • Persistence Timer • When acknowledgment with non-zero window size after zero window size is lost, to correct deadlock, TCP uses a persistence timer for each connection • When the sending TCP receives an acknowledgment with a window size of zero, the persistence timer is started • When persistence timer goes off, the sending TCP sends a special segment called a probe • The probe alerts the receiving TCP that the acknowledgment was lost and should be resent • If a response is not received, the sender continues sending the probe segments and doubling, and resetting the value of the persistence timer until the value reaches a threshold (usually 60 seconds) • After that sender sends one probe segment every 60s until the window is reopened

  27. TCP Timers • Keepalive Timer • Used to prevent a long idle connection between two TCPs. • Each time the server hears from a client, it resets this timer • Time-out is usually 2 hours • After 2 hours, sending 10 probes to client (each 75 secs), then terminates connection • TIME-WAIT Timer • The time-wait timer is used during connection termination

  28. 12.10 Options • The TCP header can have up to 40 bytes of optional information • Options convey additional information to the destination or align other options • Two categories of options • one-byte options • multiple-byte options

  29. Options

  30. 12.11 TCP Package • A TCP package involving a table called Transmission Control Blocks, a set of timers, and three software modules: main module, input processing module, output processing module.

  31. TCP Package (Cont’d) • Transmission Control Block (TCBs) • To control the connection, TCP uses a structure to hold information about each connection • TCP keeps an array of TCBs in the form of a table

  32. TCP Package (Cont’d) • State : defining the state of the connection according to the state transition diagram • Process : defining the process using this connection at this machine as a client or a server • Local IP address : defining the IP address of the local machine used by this connection • Local port number : defining the local port number used by this connection • Remote IP address • Remote port address • Interface : defining the local interface • Local window : holding information about the window at the local TCP • Remote window

  33. TCP Package (Cont’d) • Sending sequence number • Receiving sequence number • Sending ACK number • Time-out values : retransmission time-out, persistence time-out, keepalive time-out, and so on • Buffer size : defining the size of the buffer at the local TCP • Buffer pointer : pointer to buffer where the receiving data is kept until is read by the application

  34. TCP Package (Cont’d) • Main Module : The main module is invoked by an arrived TCP segment, a time-out, or a message from an application program

  35. TCP Package (Cont’d) • Main Module (cont’d)

  36. TCP Package (Cont’d) • Main Module (cont’d)

  37. TCP Package (Cont’d) • Main Module (cont’d)

  38. TCP D Package (Cont’d) • Main Module (cont’d)

  39. TCP Package (Cont’d) • Main Module (cont’d)

  40. TCP Package (Cont’d) • Main Module (cont’d)

  41. TCP Package (Cont’d) • Main Module (cont’d)

  42. TCP Package (Cont’d) • Main Module (cont’d)

  43. TCP Package (Cont’d) • Input processing module • handles all the details needed to process data or acknowledgment received when TCP is in the ESTABLISHED state • sends an ACK if needed, takes care of the window size, does error checking, and so on • Output processing module • handles all the details needed to send out data received from application program when TCP is in the ESTABLISHED state • handles retransmission time-outs, persistent time-outs, and so on

More Related