Ch 3. Transport Layer Myungchul Kim
2 Transport-Layer Service – A transport-layer protocol: logical communications between application processes running on different hosts. – Processes vs hosts – A transport protocol can offer reliable data transfer service to an application even when the underlying ntwork protocol is unreliable. – IP, a best-effort delivery service: logical communications between hosts, unreliable service – Extending host-to-host delivery to process-to-process delivery is called transport-layer multiplexing and demultiplexing.
3
4 Multiplexing and demultiplexing – Demultiplexing: delivering the data in a transport-layer segment to the correct socket – Multiplexing: passing the segments to the network layer – 16 bit number for port number including 1 to 1023 for well-known port numbers
5 - Each socket in the host could be assigned a port number. - A UDP socket is identified by a destination IP address and destination port number - A TCP socket is identifed by a four-tuple
6
7
8 Connectionless Transport: UDP – Multiplexing/demultiplexing and light error checking – No handshaking – Finer application-level control over what data is sent, and when – No connection establishment – No connection state – Small packet header overhead: TCP 20 bytes of header and UDP 8 bytes of overhead – TCP is increasingly being used for streaming media transport – The lack of congesting control in UDP?
9
10 – UDP checksum: the 1’s complement of the sum of all the 16-bit words in the segment at the sender -> if no errors are introduced into the packet, the sum at the receiver will be all 1’s. – Errors in a link-layer or a router’s memory
11 Principles of reliable data transfer – Unidirection data transfer
12 o Reliable data transfer over a perfectly reliable channel rdt1.0
13 o Reliable data transfer over a channel with bit errors rdt2.0 – Rdt1.0: perfectly reliable channel, no limit of receiving speed – Error detection and Acknowledgement (ack, nak) – Automatic Repeat reQuest (ARQ) protocols; error detection, receiver feedback and retransmission – Stop-and-wait protocol
14
15 o Reliable data transfer over a channel with bit errors rdt2.1 – Rdt 2.0: ack or nak packet could be corrupted – Sequence number of 0 or 1 – Duplicate acks: a sender that receives two ACKs for the same packet knows that receivers did not correctly receive the packets following the duplicated acked packet.
16
17
18 o Reliable data transfer over a channel with bit errors rdt2.2 – a NAK-free protocol – same functionality as rdt2.1, using ACKs only – instead of NAK, receiver sends ACK for last pkt received OK receiver must explicitly include seq # of pkt being ACKed – duplicate ACK at sender results in same action as NAK: retransmit current pkt
19
20
21 o Reliable data transfer over a lossy channel with bit errors rdt3.0 – Rdt 2.0: packet loss – Countdown timer – Alternating-bit protocol
22
23
24 Pipelined reliable data transfer protocols – Rdt3.0: performance problem due to a stop-and-wait protocol – Transmission delay = L/R = 8000 bits/packet / 10 9 bits/sec = 8 microseconds. where R= 1 Gbps, L = 1,000 bytes – Utilization of sender U sender = L/R / (RTT + L/R) =.008 / = where RTT = 30 milliseconds - Effective throughput of only 267kbps for a 1 Gbps link - Pipelining: the sender is allowed to send multiple packets without waiting for acknowledgements.
25
26 Go-Back-N (GBN) – Window size – A sliding window protocol – Receipt of an ack at the sender: Cumulative acknowledgement – The receiver discards out-of-order packets -> no buffers at the receiver
27
28
29
30 Selective Repeat (SR) – The receiver individually acknowledge correctly received packets. – The sender and receiver will not always have an identical view of what has been received correctly and what has not.
31
32
33 Connection-oriented Transport: TCP – Full-duplex service – Point-to-point – Three-way handshake – Maximum segment size (MSS) – Maximum transmission unit (MTU)
34
35 – Cumulative acknowledgements – The acknowledgement number that Host A puts in its segment is the sequence number of the next byte Host A is expecting from Host B.
36
37 Round-trip time estimation and timeout – EstimatedRTT = (1-α) * EstimatedRTT + α * SampleRTT – α = – DevRTT = (1 -β)*DevRTT + β * |SampleRTT – EstimatedRTT| – TimeoutInterval = EstimatedRTT + 4* DevRTT
38 Reliable data transfer – A single retransmission timer; associate with the oldest unacknowledged segment – TCP uses cumulative acknowledgement
39
40
41
42
43 o Doubling the Timeout Interval – Each time TCP retransmits, it sets the next timeout interval to twice the previous value. o Fast retransmit – A duplicate ACK is an ACK that reacknowledgements a segment for which the sender has already received an earlier acknowledgement. – Three duplicate ACKs -> TCP sender performs a fast retransmit, retransmitting the missing segment before that segment’s timer expires. – why three? o TCP is a hybrid of GBN and SR protocols.
44
45 Flow control – Eliminate the possibility of the sender overflowing the receiver’s buffer – Sender maintains a variable called the receive window – LastByteRead: the number of the last byte in the data stream read from the buffer by the application process in B – LastByteRcvd: the number of the last byte in the data stream that has arrived from the network and has been placed in the receive buffer at B
46 – LastByteRcvd – LastByteRead ≤ RcvBuffer – RcvWindow = RcvBuffer – [ LastByteRcvd – LastByteRead] – No overflow at the receive buffer : LastByteSent – LastByteAcked ≤ RcvWindow (at the sender) – Host A continues to send segments with one data byte when B’s receive window is zero.
47 TCP connection management – Three-way handshake
48
49
50 Principles of congestion control – Scenario 1
51
52 – Scenario 2 – Offered load to the network
53
54 – Scenario 3
55
56 Approaches to congestion control o End-to-end congestion control – The network layer provides no explicit support to the transport layer for congestion control purpose. – Congestion is inferred on observed network behavior such packet loss and delay. – TCP o Network-assisted congestion control – ATM Available bit-rate (ABR) congestion control
57
58 Network-assisted congestion-control example: ATM ABR congestion control – Explicitly signaling to the sender to reduce its rate when the switch becomes congested. – Resource-management cells (RM cells) o Signaling congestion-related information – Explicit forward congestion indication (EFCI) bit in data cells – Congestion indication (CI) and No increase (NI) bits in RM cells – Explict rate setting
59 TCP congestion control – Congestion window – LastByteSent – LastByteAcked ≤ min{CongWin, RcvWindow} – At the beginning: sending rate = CongWin / RTT o Additive-Increase, Multiplicative-Decrease (AIMD) – Halving the current value of CongWin after a loss event – Not allowed to drop below 1 MSS – Increase CongWin by 1 MSS every round-trip time – Congestion avoidance
60 o Slow start – A TCP sender increases its rate exponentially by doubling its value of CongWin every RTT
61 o Reaction to timeout events – A triple duplicate ACK -> fast recovery: ½ CongWin – A timeout -> a slow start – Vegas: the longer the RTT of the packets, the greater the congestion in the routers
62 Fairness
63 – Fairness and UDP – Fairness and parallel TCP connections